2011-08-31 [设为首页和加入收藏兼容各浏览器代码]
来源:互联网 发布:手机阅读软件哪个好 编辑:程序博客网 时间:2024/05/30 04:51
js:
//为首页JS,加入收藏夹js,加入收藏夹代码,设为首页代码,火狐和ie兼容
function AddFavorite(sURL, sTitle) {
try {
if (document.all) {
window.external.addFavorite(sURL, sTitle);
}
else if (window.sidebar) {
window.sidebar.addPanel(sTitle, sURL, "");
}
} catch (e) {
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
function SetHome(obj, vrl) {
try {
obj.style.behavior = 'url(#default#homepage)'; obj.setHomePage(vrl);
}
catch (e) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch (e) {
alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', vrl);
}
}
}
html:
<li><a target="_blank" href="javascript:SetHome(this,window.location);" onclick="SetHome(this,window.location)"
title="设为首页">设为首页</a></li>
<li>|<a target="_blank" href="javascript:AddFavorite(window.location,document.title);" onclick="AddFavorite(window.location,document.title)"
title="加入收藏">加入收藏</a></li>
- 2011-08-31 [设为首页和加入收藏兼容各浏览器代码]
- 设为首页代码和加入收藏代码-兼容各种浏览器
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- 设为首页代码和加入收藏代码(兼容各种浏览器)
- 兼容各浏览器的js加入收藏,设为首页代码
- javascript“设为首页”与“加入收藏”兼容多浏览器代码
- 加入收藏与设为首页代码(兼容各种浏览器)
- 兼容各种浏览器的‘设为首页’和‘加入收藏’的js代码
- “设为首页”和“加入收藏”功能的兼容代码
- 设为首页加入收藏代码_兼容各浏览器ie系列Firefox
- 设为首页加入收藏代码_兼容各浏览器ie系列Firefox
- 设为首页/加入收藏代码_兼容各浏览器ie系列 Firefox/360 部分不兼容 请自己尝试
- 设为首页代码和加入收藏代码
- 设为首页和加入收藏的代码
- c# 设为首页和加入收藏代码
- 如何做好项目规划,完成一个保质保量的软件工程!
- 2011-08-31 [google搜索js代码]
- 《The design of FreeType 2》中译版
- 你是优秀的程序员吗?
- android中的字体闪烁
- 2011-08-31 [设为首页和加入收藏兼容各浏览器代码]
- 美国科学家用黄芪研制出“返老还童”药剂
- 最佳视频播放器:Adobe Flash Media Playback
- Ronarex2.2 破解文件
- mfc生成随机数
- mutex 互斥锁线程控制
- 查指定image字段类型在哪些表中有
- Java final字段的初始化详解
- 收藏一些 JQuery 导航插件