<li><a
href="javaScript:AddFavorite(window.location,document.title)"
style="cursor: hand">加入收藏</a></li>
<li><a href="javaScript:SetHome(window.location)"
style="cursor: hand">設爲首頁</a></li>
<script>
//
function AddFavorite(sURL, sTitle) {
try {window.external.addFavorite(sURL, sTitle);
} catch (e) {
try {
window.sidebar.addPanel(sTitle, sURL, "");
} catch (e) {
$.msg.alert("加入收藏失敗,請使用Ctrl+D進行添加");
}
}
}
//設爲首頁
function SetHome(url){
if (document.all){
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage(url);
} else if (window.sidebar) {
if (window.netscape){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}catch (e){
$.msg.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', url);
}
}
</script>