久艹网,亚洲一日韩欧美中文字幕2019,国产欧美日韩精品专区黑人,一区二区三区久久99

中山php|最優(yōu)網(wǎng)絡(luò)中山做網(wǎng)站 中山php建站

最優(yōu)良人

2011/11/18 at 10:05

設(shè)為首頁(yè),加入收藏js代碼(兼容ie火狐c(diǎn)hrome主流瀏覽器)

使用時(shí)直接調(diào)用函數(shù),不需設(shè)定網(wǎng)站標(biāo)題等

<span onclick ='addFav()'> 收藏本站 </span>

<span onclick ='setHomepage()'> 設(shè)為首頁(yè) </span>

<script type='text/javascript'>
function addFav(){ // 加入收藏夾
if (document.all) {
window.external.addFavorite(window.location.href, document.title);
} else if (window.sidebar) {
window.sidebar.addPanel(document.title, window.location.href, "");
}
}

function setHomepage(){ // 設(shè)置首頁(yè)
if (document.all) {
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage(window.location.href);
} else if (window.sidebar) {
if(window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
}
catch (e) {
alert('此操作被瀏覽器拒絕!\n請(qǐng)?jiān)跒g覽器地址欄輸入“about:config”并回車\n然后將 [signed.applets.codebase_principal_support]的值設(shè)置為’true’,雙擊即可。');
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', window.location.href);
}
}
}

</script>

if (window.sidebar)是判斷FF的一種方法,就像判斷IE用if (document.all)一樣

標(biāo)簽:
-