Home > Web Front-end > JS Tutorial > body text

JavaScript加入收藏夹功能(兼容IE、firefox、chrome)_javascript技巧

WBOY
Release: 2016-05-16 16:50:07
Original
2048 people have browsed it

实现代码:

复制代码 代码如下:

<script><BR>function addFav(){<BR> if(document.all){<BR> window.external.addFavorite('http://jb51.net','FREE Web Directory');<BR> }else if(window.sidebar){<BR> window.sidebar.addPanel('FREE Web Directory', 'http://jb51.net','');<BR> }<BR>}<br><br></script>
加入收藏

javascript 加入收藏夹,需要注意一个细节的地方,如果 上面没有加 “rel=sidebar” ,那么将会报错: window.sidebar.addPanel is not a function。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!