当前位置: 代码迷 >> Web前端 >> window.external.addFavorite 增添收藏夹的一些技巧
  详细解决方案

window.external.addFavorite 增添收藏夹的一些技巧

热度:609   发布时间:2012-10-26 10:30:59.0
window.external.addFavorite 添加收藏夹的一些技巧
<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("加入收藏失败,有劳您手动添加。");
        }
    }
}
</script>
<a href="JavaScript:window.external.AddFavorite('http://127.0.0.1','Page')"> <font color="white">

添加到收藏夹 </FONT> </a>


是用来添加到收藏夹的

关闭网页时弹出设为主页对话框代码:
<BODY id=iehomepage
onunload="iehomepage.style.behavior=’url(#default#homepage)’;if(!(iehomepage.isHomePage(’

htto;//www.csdn.net’)))iehomepage.setHomePage(’htto;//www.csdn.net’);">

打开网页弹出设为主页对话框代码:
<BODY id=iehomepage
onload="iehomepage.style.behavior=’url(#default#homepage)’;if(!(iehomepage.isHomePage(’

htto;//www.csdn.net’)))iehomepage.setHomePage(’htto;//www.csdn.net’);">

单击链接设为主页
<a href=# onClick="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’

htto;//www.csdn.net’);">设为主页</a>

鼠标滑过设定为主页
<a href=# onMouseOver="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’

htto;//www.csdn.net’);">设为主页</a>

附添加到收藏夹代码:

离开网页时弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}</script>
<body onunload="bookmarkit()">

网页载入时弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}/
</script>
<body onload="bookmarkit()">

右键弹出
<script language=javascript1.2>
document.all.onMouseDown=new Function("if (event.button==2||event.button==3)

window.external.addFavorite(’htto;//www.csdn.net’,'我的家')")/
</script>

单击文字弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}/
if (document.all)document.write(’<a href="#" onClick="bookmarkit()">加入收藏夹</a>’)
</script>

鼠标滑过文字弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.csdn.net’,'我的家')}/
if (document.all)document.write(’<a href="#" onMouseOver="bookmarkit()">加入收藏夹</a>’)
  相关解决方案