163顶部广告收缩效果


<script type="text/javascript">
var intervalId = null;
function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){
  this.stayTime=nStayTime*1000 || 3000;
  this.maxHeigth=nMaxHth || 150;
  this.minHeigth=nMinHth || 1;
  this.state=sState || "down" ;
  var obj = document.getElementById(id);
  if(intervalId != null)window.clearInterval(intervalId);
  function openBox(){
  var h = obj.offsetHeight;
  obj.style.height = ((this.state == "down") ? (h + 2) : (h - 2))+"px";
    if(obj.offsetHeight>this.maxHeigth){
    window.clearInterval(intervalId);
    intervalId=window.setInterval(closeBox,this.stayTime);
    }
    if (obj.offsetHeight<this.minHeigth){
    window.clearInterval(intervalId);
    obj.style.display="none";
    }
  }
  function closeBox(){
  slideAd(id,this.stayTime,"up",nMaxHth,nMinHth);
  }
  intervalId = window.setInterval(openBox,10);
}
</script>
</head>
<body style="font-size:14px;margin:0;padding:0">
<div id="MyMoveAd" style="background:#ff0;height:12px;overflow:hidden;">
<ul>
<li>[url]http://bbs.shejijh.com/</li>[/url]
这是你的广告内容
</ul>
</div>
<script type="text/javascript">
<!--
slideAd('MyMoveAd',5);
-->
</script>
</body>
</html>

你可能感兴趣的:(html,js,Ajax,xml,css,div)