Js implements a method that automatically disappears large advertisements when the webpage slides out in the upper-right corner. js webpage
The example in this article describes how js automatically disappears large advertisements when sliding out of the upper-right corner of a webpage. Share it with you for your reference. The specific implementation method is as follows:
Copy codeThe Code is as follows: <! 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">
<Head>
<Title> significant advertisement effects that will automatically disappear when the js webpage slides out in the upper-right corner </title>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<! -- Add the following code between <Script type = "text/javascript" language = "javascript">
Var time = 500;
Var w = 0;
Function addCount ()
{
If (time> 0)
{
Time --;
W = w + 5;
}
Else
{
Return;
}
If (w> 278) // width
{
Return;
}
Document. getElementById ("ads"). style. display = "";
Document. getElementById ("ads"). style. width = w + "px ";
SetTimeout ("addCount ()", 30 );
}
Window. onload = function showAds ()
{
AddCount ();
SetTimeout ("noneAds ()", 3000); // stay time
}
</Script>
<Script type = "text/javascript" language = "javascript">
Var T = 198;
Var N = 188; // height
Function noneAds ()
{
If (T> 0)
{
T --;
N = N-5;
}
Else
{
Return;
}
If (N <0)
{
Document. getElementById ("ads"). style. display = "none ";
Return;
}
Document. getElementById ("ads"). style. width = N + "px ";
SetTimeout ("noneAds ()", 30 );
}
</Script>
</Head>
<Body>
<! -- Add the following code to the <body> and </body> -->
<Div id = "ads" style = "margin: auto; display: none; position: absolute; width: 200px; top: 0px; right: 0; height: 200px; background-color: # d5282e; overflow: hidden; text-align: center; "> <p align =" center "> welcome to <a href =" http://www.bkjia.com "target =" _ blank "> helper house </a> collect this effect on the Internet, only interest, not for commercial purposes. </P>
</Div>
</Body>
</Html>
I hope this article will help you design javascript programs.