指引网

当前位置: 主页 > 网页制作 > JavaScript >

js 设为首页与加入收藏的多种代码

来源:网络 作者:佚名 点击: 时间:2017-07-02 08:56
[摘要] 

js 设为首页与加入收藏的多种代码
1.图片链接

<a style="cursor:hand" onclick="this.style.behavior='url(#default#homepage)';
this.setHomePage('www.111cn.net');">
<img width=16 height=16 border=0 src="images/Logo.gif">
<u> 设为首页</u></a>

2.文字型:

<a onclick="this.style.behavior='url(#default#homepage)';
this.setHomePage('http://www.111cn.net');" href="#">设为首页</a>

3.按钮型:

<input TYPE="button" VALUE=" 设为首页 " onclick="this.style.behavior='url(#default#homepage)';
this.setHomePage('http://www.111cn.net');" href="#">

4.鼠标指向时提示设为首页

<A href="http://www.qipao8.com/" onmouseo教程ver="this.style.behavior='url(#default#homepage)';
this.setHomePage('http://www.111cn.net');" target="_blank">设为首页</A>

 

==================================================

 

加入收藏代码
1.

<a href="#" onclick="网页特效:window.external.AddFavorite('http://www.111cn.net','中国网客网')" title="收藏本站到你的收藏夹"><font size="-1" color="#FFE09E">收藏本站</font></a>

2.

<a href="javascript:void(0);" onClick="window.external.AddFavorite(document.location.href,document.title)">加入收藏</a>
加入频道
<a href="typhoon.cdf")>加入频道</a>

邮件链接

<a href="mailto:spcx1709@126.com">与我联系</a>

解决兼容问题:

<script type="text/javascript">
function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败,请使用Ctrl+D进行添加");
        }
    }
}
</script>

<a href="#" onclick="AddFavorite(window.location,document.title)" style="cursor:pointer");" >收藏本站</a>

------分隔线----------------------------