加入收藏和设为主页代码

阅读更多

 

转自:http://hi.baidu.com/563944808/item/7ec49ed53a95f5c81b72b46c

 

 

名种样式的加入收藏和设为主页代码。
还有一些最基本的html代码,只供初学者参考。
注意:此代码只兼容IE浏览器
1:实现”

加入收藏”功能的代码如下:

入收藏

你只需将链接与站名改为你自己的站名即可.

如果你要实现鼠标划过时即提示是否加入收藏,只需将代码改为:

onmouseover=”window.external.addFavorite(‘http://www.baidu.com‘,‘百度‘)” target=_self href= >加入收藏
----------------------------------
2.设为首页代码(html源码)

href="http://www.baidu.com/">http://www.baidu.com

图片链接
this.setHomePage

(‘http://www.baidu.com/‘);”>

Set as Home

Page

1.文字型:
< a onclick=”this.style.behavior=‘url(#default#homepage)‘;this.setHomePage(‘http:

//www.baidu.com/‘);” href=”#”>设为首页
范例:
设为首页

2.按钮型:
< input TYPE=”button” VALUE=” 设为首页 ”

onclick=”this.style.behavior=‘url (#default#homepage)‘;this.setHomePage(‘http://www.baidu.com/‘);” href=”#”>

开时自动提示设为首页

(‘http://www.baidu.com/‘)))BASEBody.setHomePage(www.baidu.com//‘);”>

—————

———————————————-
打开页面时自动弹出窗口询问是否设为首页
将以下代码放在之间:

language=”javascript”>
function myhomepage(){
this.homepage.style.behavior=’url(#default#homepage)’;this.homepage.sethomepage(‘http://www.baidu.com’);
}


onclick=”myhomepage();”>

再将下面代码加入内

onload=”myhomepage();”
即:

——————————————————————–
鼠标指向时提示设为首页

将下列代码插入区中:

onmouseover =”this.style.behavior=’url(#default#homepage)’;this.setHomePage(‘http://www.baidu.com/’); ” target=”_blank”>设为首页
—————————

—————————————–
关闭当前窗口的功能

这里我们可以先输入用来标示的文字“关闭窗口”,用鼠标拖动选中它,在“Link”输入框中键入“/”,同时切入源代

码窗口,在链接代码中键入该事件-onclick=”javascript:window.close(); return false;”。
完整的代码为:< a href=”/”onclick=”javascript:window.close(); return false;”>关闭窗

口< /a>

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

3.联系站长的话实际上是链接到一个电子邮箱地址:
电子信箱

href="mailto:baidujishubu">mailto:lmyekong

你可能感兴趣的:(html,加入收藏,设为首页,js)