disucz设为首页和收藏网站js代码


js函数:

function setHomepage(sURL) {
    if(!+[1,]){
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage(sURL);
    } else {
        alert("非 IE 浏览器请手动将本站设为首页");
    }
}
function addFavorite(url, title) {
    try {
        window.external.addFavorite(url, title);
    } catch (e){
        try {
            window.sidebar.addPanel(title, url, '');
        } catch (e) {
            showDialog("请按 Ctrl+D 键添加到收藏夹");
        }
    }
}

html代码

<a href="javascript:;" onclick="setHomepage('http://www.zhangweijie.net');">设为首页</a>
<a href="http://www.zhangweijie.net" onclick="addFavorite(this.href, '维摩诘');return false;">收藏网站</a>
普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress