滑动展开_收缩广告代码
代码:[code]<!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 9v-H!k|Mf5ox8h<html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312"> l O*lgVT`C
<head>
<title> 代码实例:滑动展开/收缩广告 </title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" /> x3k-F@(^ m
<meta name="author" content="jz123cn@126.com">
<meta name="keywords" content="代码实例:滑动展开/收缩广告" />
<script type="text/javascript"> (LK7A&NH8w
var intervalId = null;
function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){ 5pLSRH%Jb
this.stayTime=nStayTime*1000 || 3000;
this.maxHeigth=nMaxHth || 90;
this.minHeigth=nMinHth || 1; V/mw0i ~K
this.state=sState || "down" ; 6ob5W@ TCY$W
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"; {:n]*Z2n
if(obj.offsetHeight>this.maxHeigth){ NCZ3Y cO;@
window.clearInterval(intervalId);
intervalId=window.setInterval(closeBox,this.stayTime);
} )bpI5P/_ \8L`8r
if (obj.offsetHeight<this.minHeigth){
window.clearInterval(intervalId);
obj.style.display="none"; K Z.XG e ZI
}
}
function closeBox(){
slideAd(id,this.stayTime,"up",nMaxHth,nMinHth); Z_LM9B(~[
}
intervalId = window.setInterval(openBox,10);
}
</script>