标签:
<a href="#" onclick="window.external.addFavorite(‘http://www.baidu.com‘,‘新闻发布网站‘);" >收藏本站</a>
其中a href="#" 没什么用,关键看后面的onClick事件
<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>’)
原文地址;http://www.csharpwin.com/dotnetspace/7078r9951.shtml
window.external.addFavorite 添加收藏夹的一些技巧
标签:
原文地址:http://www.cnblogs.com/lyy445910200/p/5478464.html