复制代码 代码如下:
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;
}
}
};
<a href="javascript:void(0);return false;" onMouseDown="www_jb51_net(this, '//www.jb51.net', '北冥有鱼是国内专业的网站建设资源、脚本编程学习类网站')">收藏北冥有鱼</a>
您可能感兴趣的文章:
- Js event事件在IE、FF兼容性问题
- JS IE和FF兼容性问题汇总
- JS的IE和Firefox兼容性集锦
- js离开或刷新页面检测(且兼容FF,IE,Chrome)
- JS事件在IE与FF中的区别详细解析
- 引用 js在IE与FF之间的区别详细解析
- js文本框输入点回车触发确定兼容IE、FF等
- IE网页js语法错误2行字符1、FF中正常的解决方法
- IE、FF、Chrome浏览器中的JS差异介绍
- JavaScript在IE和FF下的兼容性问题