Advertising function Description:
Sliding expansion/contraction advertising effect, you can specify: The full expansion of the ad when the stay time, the maximum height
Compatible Browsers:
ie5.0+, ff1.06+, opera8.0+
Instance code:
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">
<title> code example: Sliding expansion/shrinking advertising </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<meta name= "Author" content= "Maple Rock, CNLei.y.l@gmail.com" >
<meta name= "keywords" content= "code instance: Sliding expansion/shrinking advertisement"/>
<script type= "Text/javascript" >
var intervalid = null;
function Slidead (id,nstaytime,sstate,nmaxhth,nminhth) {
this.staytime=nstaytime*1000 | | 3000;
this.maxheigth=nmaxhth | | 90;
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>
<body style= "MARGIN:0;PADDING:0;FONT-SIZE:14PX;" >
<div id= "Mymovead" style= "background: #ff0; height:12px;overflow:hidden;" >
<ul>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
<li> here is the content in the advertisement </li>
</ul>
</div>
<p> Code Instance:<strong> slide Expand/Shrink advertisement </strong> Please refresh the page and watch the demo again </p>
<script type= "Text/javascript" >
<!--
Slidead (' Mymovead ', 2);
-->
</script>
</body>