JS网页顶部弹出可关闭广告图层

时间:2022-04-23
本文章向大家介绍JS网页顶部弹出可关闭广告图层,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="keywords" content="站长,网页特效,js特效,js脚本,脚本,广告代码,zzjs,zzjs.net,sky,www.zzjs.net,站长特效 网" />
<meta name="description" content="www.zzjs.net,站长特效网,站长必备js特效及广告代码。全力打造一流网页特效站!" />
<title>网页特效 网页顶部弹出可关闭广告图层 站长特效网</title>
<style type="text/css">
#informationbar{
 position: fixed;
 left: 0;
 width: 100%;
 text-indent: 5px;
 padding: 5px 0;
 background-color: lightyellow;
 border-bottom: 1px solid black;
 font: bold 12px Verdana;
}
* html #informationbar{
 position: absolute;
 width: expression(document.compatMode=="CSS1Compat"? document.documentElement.clientWidth+"px": body.clientWidth+"px");
}
</style>
</head>
<body>
<a href="http://www.zzjs.net/">站长特效网</a>,以质量为核心,以实用为目的,打造一流网页特效站!zzjs.net,站长js特效。<hr>
<!--欢迎来到站长特效网,我们网站收集大量高质量js特效,提供许多广告代码下载,网址:www.zzjs.net,zzjs@msn.com,用.net打造靓站-->
<script type="text/javascript">
function informationbar(){
 this.displayfreq="always"
 this.content='<a href="javascript:informationbar.close()"><img src="/img/msgClose.gif" style="width:14px;height:14px;float:right;border:0;margin-right:5px;"></a>'
}//欢迎来到站长特x效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
informationbar.prototype.content_zzjs_net=function(data){
 this.content=this.content+data
 document.write('<div id="informationbar" style="top: -500px">'+this.content+'</div>')
}//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
informationbar.prototype.animatetoview=function(){
 var barinstance=this
 if (parseInt(this.barref.style.top)<0){
  this.barref.style.top=parseInt(this.barref.style.top)+5+"px"
  setTimeout(function(){barinstance.animatetoview()}, 50)
 }
 else{
  if (document.all && !window.XMLHttpRequest)
  this.barref.style.setExpression("top", 'document.compatMode=="CSS1Compat"?document.documentElement.scrollTop+"px":body.scrollTop+"px"')
 else
  this.barref.style.top=0
 }
}//欢迎来到站q长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
informationbar.close=function(){
 document.getElementById("informationbar").style.display="none"
 if (this.displayfreq=="session")
  document.cookie="infobarshown=1;path=/"
}//欢迎来到站长特效网,我们的网址是w ww.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
informationbar.prototype.setfrequency=function(type){
 this.displayfreq=type
}//欢迎来到站长特效网,我们的网址是www.zz js.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
informationbar.prototype.init_zzjsnet=function(){
 if (this.displayfreq=="session" && document.cookie.indexOf("infobarshown")==-1 || this.displayfreq=="always"){
  this.barref=document.getElementById("informationbar")
  this.barheight=parseInt(this.barref.offsetHeight)
  this.barref.style.top=this.barheight*(-1)+"px"
  this.animatetoview()
 }
}//欢迎来到站长特效.网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
window.onunload=function(){
 this.barref=null
}//欢迎来到站长特效网,我们的网址是ww.w.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
//Invocation code
var infobar=new informationbar()
infobar.content_zzjs_net('站长特效网,高质量网页特效代码,广告代码,js特效代码网站!以质量为核心,以实用为目的,打造一流网页特效站!www .zzjs .net')
infobar.init_zzjsnet()
</script>
</body>
</html>