设为主页代码及添加到收藏夹代码大全

View Code
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>设为首页的JS代码</title>

</head>

<body> 

<p>方法一:<span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.codefans.net');"  style="CURSOR: hand">点此设为首页</a></span></p>

<p><br>

方法二:<a title="设为首页" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.csdn.net');" href="javascript:;">设为首页</a>

</p>

</body>

</html>

 

 

 

 

 

href='#' onclick='window.external.AddFavorite("http://dotnet.aspx.cc/","【孟宪会之精彩世界】")'>
加入收藏
</a> <href='#' onclick="window.external.ShowBrowserUI('OrganizeFavorites', null)">整理收藏</a>
<link rel="ShortcutIcon" href="favicon.ico">
<href="http://www.163.com" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.163.com/')">设163为首页</a>

-------------------------------------------------------
(1)设为主页代码:

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

打开网页弹出设为主页对话框代码:
<BODY id=iehomepage 
onload="iehomepage.style.behavior='url(#default#homepage)';if(!(iehomepage.isHomePage('http://www.baxun.com')))iehomepage.setHomePage('http://www.baxun.com');">

单击链接设为主页
<href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.baxun.comt');">设为主页</a>

鼠标滑过设定为主页
<href=# onMouseOver="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.baxun.com');">设为主页</a>

(2)添加到收藏夹代码:

离开网页时弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite('http://www.baxun.com','个人网站')}</script>
<body onunload="bookmarkit()">

网页载入时弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite('http://www.baxun.com','个人网站')}
</script>
<body onload="bookmarkit()">

右键弹出
<script language=javascript1.2>
document.all.onMouseDown
=new Function("if (event.button==2||event.button==3)window.external.addFavorite('http://www.baxun.com','个人网站')")
</script>

单击文字弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite('http://www.baxun.com','个人网站')}
if (document.all)document.write('<a href="#" onClick="bookmarkit()">加入收藏夹</a>')
</script>

鼠标滑过文字弹出
<script language="javascript">
function bookmarkit(){window.external.addFavorite('http://www.baxun.com','个人网站')}
if (document.all)document.write('<a href="#" onMouseOver="bookmarkit()">加入收藏夹</a>')

---------------------------------------------------------

<HTML>
    
<HEAD>
        
<title>添加到收藏夹和设置首页代码大全</title>
        
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        
<meta name="CODE_LANGUAGE" Content="C#">
        
<meta name="vs_defaultClientScript" content="JavaScript">
        
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        
<script language="javascript">
        
<!--
            
//添加到收藏夹代码---------------------------------------------
            function bookmarkit()
            
{
                window.external.addFavorite(
'http://singlepine.cnblogs.com/','小山的博客园')
            }

            
//1.离开网页时弹出
            //<body onunload="bookmarkit()">
            
            
//2.网页载入时弹出
            //<body onload="bookmarkit()">
            
            
//3.右键弹出            
            document.all.onMouseDown=new Function("if (event.button==2||event.button==3)window.external.addFavorite('http://singlepine.cnblogs.com/','小山的博客园')")
            
            
//4.单击文字弹出
            //5.鼠标滑过文字弹出
            //----------------------------------------------------
            
            
//设为主页代码---------------------------            
            //1.关闭网页时弹出设为主页对话框代码
            //<BODY id=iehomepage onunload="iehomepage.style.behavior='url(#default#homepage)';if(!(iehomepage.isHomePage('http://singlepine.cnblogs.com/')))iehomepage.setHomePage('http://singlepine.cnblogs.com/');"> 

            
//2.打开网页弹出设为主页对话框代码
            //<BODY id=iehomepage onload="iehomepage.style.behavior='url(#default#homepage)';if(!(iehomepage.isHomePage('http://singlepine.cnblogs.com/')))iehomepage.setHomePage('http://singlepine.cnblogs.com/');">
            
            
//3.单击链接设为主页
            //4.鼠标滑过设定为主页
            
        
//-->
        
</script>
    
</HEAD>
    
<body id="iehomepage" MS_POSITIONING="GridLayout">
        
<form id="Form1" method="post" runat="server">
            
<href="#" onclick="bookmarkit()">加入收藏夹</a><br>
            
<br>
            
<br>
            
<br>
            
<href="#" onmousemove="bookmarkit()">鼠标滑过文字弹出收藏夹</a>
            
<br>
            
<br>
            
<br>
            
<br>
            
<href="#" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://singlepine.cnblogs.com/');">
                单击链接设为主页
</a>
            
<br>
            
<br>
            
<br>
            
<br>
            
<href="#" onmousemove="this.style.behavior='url(#default#homepage)';this.setHomePage('http://singlepine.cnblogs.com/');">
                鼠标滑过设定为主页
</a>
        
</form>
    
</body>
</HTML>

posted @ 2012-12-19 17:15  盛开的雨季  阅读(580)  评论(0编辑  收藏  举报