特效:页面内容在设定时间后消失
发布时间:2006-04-05 10:11:40 来源:天极网 网友评论 0 条
<!-- 要实现此效果需要 1 个步骤: -->
<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->
<SCRIPT LANGUAGE="JavaScript1.2">
adTime=10; // seconds ad reminder is shown
chanceAd=1; // ad will be shown 1 in X times (put 1 for everytime)
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-200;adDiv.top =documentHeight-200;
setTimeout("showAd()",100);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}
onload=initAd;
//End-->
</script>
<div id="sponsorAdDiv" style="visibility:hidden">
<table bgcolor="#008000"><tr><td>
<table width="300" bgcolor="#F0FFF0"><tr><td align="center" valign="middle">
<p><b>网络编程站欢迎你的光临<br>
请多提宝贵意见,谢谢<br>
你的光临是对我们最大的支持.</b>
</p>
<p>(这个显示区将在几秒钟内自动关闭)
<br>
</td></tr></table></td></tr></table>
</div>
- 推荐阅讯
- 网页特效:一段实用的图片滚动显示代码
- 在Javascript中,什么是闭包(Closure)
- 特效:亥客帝国的经典效果
- 使用AJAX的十大理由
- 模仿Flash并实现动态弹性跳动的菜单
- 特效:页面中随机出现的星星小花絮
- 添加到收藏夹的Javascript脚本-适合IE和Fir
- 最近收集的有用的Javscript小技巧
- 特效:页面内容在设定时间后消失
- Javascript数组 sort方法的分析
- 阅读排行
- 1.网页特效:一段实用的图片滚动显示代码
- 2.网页特效实例:用js获取单选按钮的数据
- 3.Javascript特效:随机显示图片的源代码
- 4.Javascript技术技巧大全
- 5.IE和FireFox下javascript读写XML实现广告轮
- 6.用 JavaScript 来操作字符串的函数
- 7.添加到收藏夹的Javascript脚本-适合IE和Fir
- 8.怎样判断浏览器是否支持javascript?
- 9.JavaScript实现网页图片等比例缩放
- 10.网页特效:随机显示广告的JS源代码
- 专题教程
- Windows Server-Windows Server文档-Windows Server新闻-Windows Ser PostgreSQL-PostgreSQL文档-PostgreSQL新闻-PostgreSQL专家
- WebLogic-WebLogic文档-WebLogic新闻-WebLogic专家 FreeBSD-FreeBSD文档-FreeBSD新闻-FreeBSD专家
- Linux-内核 GUI KDE Gnome DNS FTP 安全 安装-Linux专区 Windows-AD IIS ServerCore 虚拟化 安全 HPC-Windows专区
- 大话G游 专题:手机病毒揭密
- ARP攻击防范与解决方案 路由故障处理手册
