加入收藏夹的一段代码,如下:
复制代码 代码示例:
<script>
/**
* 加入收藏夹
* edit by www.jb200.com
*/
function favPage()
{
var pageName=window.location.href;
var nameArr =pageName.split("?");
pageName=nameArr[0] + "?" + nameArr[1];
if (window.sidebar)
{ //侧边栏
window.sidebar.addPanel(document.title,pageName,"");
}
else if( document.all )
{
window.external.AddFavorite(pageName,document.title);
}
else
{
return true;
}
}
</script>
附,windows.external的用法。
windows.external
复制代码 代码示例:
<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.jb200.com’)))iehomepage.setHomePage(’htto;//www.jb200.com’);">
打开网页弹出设为主页对话框代码:
复制代码 代码示例:
<BODY id=iehomepage
onload="iehomepage.style.behavior=’url(#default#homepage)’;if(!(iehomepage.isHomePage(’
htto;//www.jb200.com’)))iehomepage.setHomePage(’htto;//www.jb200.com’);">
单击链接设为主页
复制代码 代码示例:
<a href=# onClick="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’
htto;//www.jb200.com’);">设为主页</a>
鼠标滑过设定为主页
复制代码 代码示例:
<a href=# onMouseOver="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’
htto;//www.jb200.com’);">设为主页</a>
附添加到收藏夹代码:
离开网页时弹出
复制代码 代码示例:
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.jb200.com’,'脚本学堂')}</script>
<body onunload="bookmarkit()">
网页载入时弹出
复制代码 代码示例:
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.jb200.com’,'脚本学堂')}/
</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.jb200.com’,'脚本学堂')")/
</script>
单击文字弹出
复制代码 代码示例:
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.jb200.com’,'脚本学堂')}/
if (document.all)document.write(’<a href="#" onClick="bookmarkit()">加入收藏夹</a>’)
</script>
鼠标滑过文字弹出
复制代码 代码示例:
<script language="javascript">
function bookmarkit(){window.external.addFavorite(’htto;//www.jb200.com’,'脚本学堂')}/
if (document.all)document.write(’<a href="#" onMouseOver="bookmarkit()">加入收藏夹</a>’)