求各位帮忙完善以下代码!!先谢谢大家了!! 急急急!

柒公子2018 2011-12-12 09:15:05
谁能把我以下代码完善

实现 24小时是弹出一次! 且 页面打开10秒后 自动刷新一次 仅仅一次!



<html>
<meta http-equiv= "Refresh " content= "5 ">
<style type="text/css">
<!--
#sponsorAdDiv {position:absolute; height:1; width:1; top:0; left:0;}
-->
</style>


<SCRIPT LANGUAGE="JavaScript1.2">



adTime=3; //关闭窗口等待的时间

chanceAd=1;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
adCount=0;
function initAd(){
if(!ns && !ie && !w3) return;
if(ie) adDiv=eval('document.all.sponsorAdDiv.style');
else if(ns) adDiv=eval('document.layers["sponsorAdDiv"]');
else if(w3) adDiv=eval('document.getElementById("sponsorAdDiv").style');
randAd=Math.ceil(Math.random()*chanceAd);
if (ie||w3)
adDiv.visibility="visible";
else
adDiv.visibility ="show";
if(randAd==1) showAd();
}
function showAd(){
if(adCount<adTime*10){adCount+=1;
if (ie){documentWidth =document.body.offsetWidth/2+document.body.scrollLeft-20;
documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}
else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
documentHeight=window.innerHeight/2+window.pageYOffset-20;}
else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
documentHeight=self.innerHeight/2+window.pageYOffset-20;}
adDiv.left=documentWidth-500;adDiv.top =documentHeight-230;
setTimeout("showAd()",100);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}
onload=initAd;
</script>


<a href="http://idc.Nogoogle.org" target="_blank">高歌免费空间</a>为草根站长提供免费的空间!<hr>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="450" height="350" bgcolor="008000"><tr><td>
<table width="445" height="345" bgcolor="F0FFF0"><tr><td>
<center>welcome to Idc.Nogoogle.Org<BR>高歌免费空间<BR><iframe id="iframe1" name=mainframe width="1024" height="800" class="STYLE1" src="http://idc.Nogoogle.org"

scrolling="no">
<BR></center>
</td></tr></table></td></tr></table></div>

<body>
</body>
</html>

...全文
83 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tzh108073 2011-12-13
  • 打赏
  • 举报
回复
加油!加油!
easyuu 2011-12-13
  • 打赏
  • 举报
回复
24小时是弹出一次,这个时间固定吗?
hch126163 2011-12-13
  • 打赏
  • 举报
回复
10 秒刷新一次是 页面刷新?还是 局部刷新?

如果是局部刷新,很简单,页面加载事件
2个 setTimeout
一个 10s 执行局部刷新,一个 24小时,执行弹出


如果是 页面刷新,需要cookie 记录当前页面是否已经刷新,不然,每10s 页面都会刷新
KeenWon 2011-12-12
  • 打赏
  • 举报
回复
要怎么完善?有什么问题?
柒公子2018 2011-12-12
  • 打赏
  • 举报
回复
来个救救我啊!

87,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧