Last Update:2017-08-24
Source: Internet
Author: User
Keywords
Web page production
Ajax
javascript
<!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> <title> code example: Sliding expansion/contraction advertisement </title> <meta http-equiv= "Content-type content=" HTML; charset=gb2312 "/> <meta name= "keywords" content= "code instance: slide Expand/Shrink advertisement"/> <script type= "Text/javascript" > var intervalid = null; function Slidead (id,nstaytime,sstate,nmaxhth,nminhth) { staytime=nstaytime*1000 | | 3000; Maxheigth=nmaxhth | | 90; Minheigth=nminhth | | 1; State=sstate | | "Down"; var obj = document.getElementById (ID); if (intervalid!= null) window.clearinterval (intervalid); function OpenBox () { var h = obj.offsetheight; Obj.style.height = (state = "Down")? (H + 2): (h-2)) + "px"; if (obj.offsetheight>maxheigth) { Window.clearinterval (intervalid); Intervalid=window.setinterval (closebox,staytime); } if (obj.offsetheight<minheigth) { Window.clearinterval (intervalid); obj.style.display= "None"; } } function CloseBox () { Slidead (Id,staytime, "up", nmaxhth,nminhth); } intervalid = Window.setinterval (openbox,10); } </script> </head> <body style= "MARGIN:0;PADDING:0;FONT-SIZE:14PX;" > <div id= "Mymovead" style= "background: #ff0; height:12px;overflow:hidden;" > <ul> <li> www.jzread.com</li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> <li> Here is the contents of the advertisement </li> </ul> </div> <p> Code Instance:<strong> sliding Expand/Shrink advertisement </strong> Please refresh the page and watch the demo again <script type= "Text/javascript" > <!-- slidead (' Mymovead ', 2); --> </script> </body> </html>