js加入收藏夾代碼(兼容ie/ff/op)_javascript技巧
來源:懂視網
責編:小采
時間:2020-11-27 21:23:19
js加入收藏夾代碼(兼容ie/ff/op)_javascript技巧
js加入收藏夾代碼(兼容ie/ff/op)_javascript技巧: 代碼如下:var www_jb51_net = function (obj, url, title) { var e = window.event arguments.callee.caller.arguments[0]; var B = { IE : /MSIE/.test(window.navigator.userAgent) && !win
導讀js加入收藏夾代碼(兼容ie/ff/op)_javascript技巧: 代碼如下:var www_jb51_net = function (obj, url, title) { var e = window.event arguments.callee.caller.arguments[0]; var B = { IE : /MSIE/.test(window.navigator.userAgent) && !win

代碼如下:
var www_jb51_net = function (obj, url, title) {
var e = window.event || arguments.callee.caller.arguments[0];
var B = {
IE : /MSIE/.test(window.navigator.userAgent) && !window.opera
, FF : /Firefox/.test(window.navigator.userAgent)
, OP : !!window.opera
};
obj.onmousedown = null;
if (B.IE) {
obj.attachEvent("onmouseup", function () {
try {
window.external.AddFavorite(url, title);
window.event.returnValue = false;
} catch (exp) {}
});
} else {
if (B.FF || obj.nodeName.toLowerCase() == "a") {
obj.setAttribute("rel", "sidebar"), obj.title = title, obj.href = url;
} else if (B.OP) {
var a = document.createElement("a");
a.rel = "sidebar", a.title = title, a.href = url;
obj.parentNode.insertBefore(a, obj);
a.appendChild(obj);
a = null;
}
}
};
收藏腳本之家
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
js加入收藏夾代碼(兼容ie/ff/op)_javascript技巧
js加入收藏夾代碼(兼容ie/ff/op)_javascript技巧: 代碼如下:var www_jb51_net = function (obj, url, title) { var e = window.event arguments.callee.caller.arguments[0]; var B = { IE : /MSIE/.test(window.navigator.userAgent) && !win