Javascript加入收藏夹代码

Javascript加入收藏夹代码

<script> function addfavorite() { if (document.all) { window.external.addFavorite('http://www.jcodecraeer.com',jcodecraeer.com');); } else if (window.sidebar) { window.sidebar.addPanel('Dnew.cn', 'http://www.jcodecraeer.com', ""); } } < /script> < a href="#" onclick="addfavorite()">把ijavascript.cn加入收藏</a>

下面这个也是Javascript加入收藏夹代码,同样支持firefox

<script type="text/javascript"> function addBookmark(title,url) { if (window.sidebar) { window.sidebar.addPanel(title, url,""); } else if( document.all ) { window.external.AddFavorite( url, title); } else if( window.opera && window.print ) { return true; } } < /script> 页面使用:<a href=javascript:addBookmark('ijavascript','http://www.jcodecraeer.com')> 添加到收藏</a>