JS积累
1. <a>标签"加入收藏",兼容IE,FireFox等
function bookmarksite() { if (window.sidebar) { // Mozilla Firefox Bookmark window.sidebar.addPanel(document.title, window.location.href, ‘‘); } else if (window.external && (‘AddFavorite‘ in window.external)) { // IE Favorite window.external.AddFavorite(location.href, document.title); } else if (window.opera && window.print) { // Opera Hotlist this.title = document.title; return true; } else { // webkit - safari/chrome alert(‘Press ‘ + (navigator.userAgent.toLowerCase().indexOf(‘mac‘) != -1 ? ‘Command/Cmd‘ : ‘CTRL‘) + ‘ + D to bookmark this page.‘); } } //加入收藏 function bookmarksite(title, url) { if (window.sidebar) // firefox window.sidebar.addPanel(title, url, ""); else if (window.opera && window.print) { // opera var elem = document.createElement(‘a‘); elem.setAttribute(‘href‘, url); elem.setAttribute(‘title‘, title); elem.setAttribute(‘rel‘, ‘sidebar‘); elem.click(); } else if (document.all)// ie window.external.AddFavorite(url, title); }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。