<a href="javascript:;" οnclick="javascript:addfavor(' http://www.baidu.com','IT有道');">加为收藏</a>
<script language="javascript">
function addfavor(url,title) {
if(confirm("网站名称:"+title+"\n网址:"+url+"\n确定添加收藏?")){
var ua = navigator.userAgent.toLowerCase();
if(ua.indexOf("msie 8")>-1){
external.AddToFavoritesBar(url,title,'IT有道');//IE8
}else{
try {
window.external.addFavorite(url, title);
} catch(e) {
try {
window.sidebar.addPanel(title, url, "");//firefox
} catch(e) {
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
}
}
return false;
}
</script>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<a href="javascript:void(0);" target="_self" οnclick="javascript:try{ window.external.AddFavorite('http://www.qt56w.com','群通物流网'); } catch(e){ (window.sidebar)?window.sidebar.addPanel('360安全网址','http://hao.360.cn/',''):alert('请使用按键 Ctrl+d,收藏360安全网址'); }">加入收藏</a>