JavaScript slide Expand/Shrink AD code

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags ajax code content function html http javascript public

<!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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.