滑动展开_收缩广告代码
代码:[code]<!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" lang="gb2312">
<head> :v#T0L$O5v3Q|w
<title> 代码实例:滑动展开/收缩广告 </title> .?}$n8c'h"l
<meta http-equiv="content-type" content="text/html; charset=gb2312" /> :L s?;fvT#R ~cw
<meta name="author" content="jz123cn@126.com"> h"y(L-J ^CE1w
<meta name="keywords" content="代码实例:滑动展开/收缩广告" /> r:vJ-kFd:?
<script type="text/javascript"> 4I.m-y4ms0f!cR:?
var intervalId = null; ~|I%?$]gnB
function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){
this.stayTime=nStayTime*1000 || 3000; 3Uw-S"q4Mp:?
this.maxHeigth=nMaxHth || 90;
this.minHeigth=nMinHth || 1;
this.state=sState || "down" ; Y^e2TU7Kx"@n
var obj = document.getElementById(id);
if(intervalId != null)window.clearInterval(intervalId); ^r5m3w/v#]6b&~ B~S0X
function openBox(){
var h = obj.offsetHeight;
obj.style.height = ((this.state == "down") ? (h + 2) : (h - 2))+"px"; B'uv]'Bx9@
if(obj.offsetHeight>this.maxHeigth){
window.clearInterval(intervalId);
intervalId=window.setInterval(closeBox,this.stayTime);
}
if (obj.offsetHeight<this.minHeigth){ y ]/~#?7^O(IO
window.clearInterval(intervalId); }8Pn1SK5@
obj.style.display="none";
} ;QQ6w5M&|@c1L {'H1gP
}
function closeBox(){ XaJ-mR!O
slideAd(id,this.stayTime,"up",nMaxHth,nMinHth); 0n,M&R}Awb
} beTO H"I)r
intervalId = window.setInterval(openBox,10);
}
</script>
</head> 5Z@?CQ*`O+E;z
<body style="margin:0;padding:0;font-size:14px;"> U)A:s_Y$z{ GSO)@ a
<div id="MyMoveAd" style="background:#ff0;height:12px;overflow:hidden;"> +gx]]M
<ul> )e9tz @]9Z a [
<li>网络之都官方论坛</li>
<li>网络之都官方论坛</li> I){ioAr
<li>网络之都官方论坛</li>
<li>网络之都官方论坛</li> %G J6SZ0yFf;Nk
<li>网络之都官方论坛</li> cRs-tJh5qo8_q'c
<li>网络之都官方论坛</li> ~:E KBp9? H8S7ZT
<li>网络之都官方论坛</li>
<li>网络之都官方论坛</li>;Y'_+B]&~K}$i
<li>网络之都官方论坛</li>
<li>网络之都官方论坛</li>
<li>网络之都官方论坛</li>*S6u/J ~8~lf
<li>网络之都官方论坛</li>#J RV#D};ZK4}
<li>网络之都官方论坛</li>x{^-fE\~o/h1T
<li>网络之都官方论坛</li> JIw2nm)}0u
<li>网络之都官方论坛</li>
</ul> ,N"H$pA6Pl*cw2hq.r
</div> ]^0dy x
<p>代码实例:<strong>滑动展开/收缩广告</strong> 请刷新页面,再次观看演示效果</p>
<script type="text/javascript"> #U_2^a4Xg0Z[T
<!--
slideAd('MyMoveAd',2); WR$F m"B:\1^/^5X
--> 4c9GH#B#|{-f UN8q
</script>
</body> F'p,|;{b&n
</html> [/code]
页:
[1]