JavaScript implementation page content disappears after set time

Source: Internet
Author: User
Javascript| Timing | page

<HTML>
<HEAD>
<meta http-equiv= ' content-type ' content= ' text/html; charset=gb2312 ' >
<TITLE> a portion of the content displayed on the page will automatically disappear after a set time </TITLE>
</HEAD>
<body >

<script language= "JavaScript1.2" >
adtime=10; Seconds ad Reminder is shown
chancead=1; Ad would be shown the 1 in X times (put 1 for everytime)

var ns= (document.layers);
var ie= (document.all);
var w3= (document.getElementById &&!ie);
adcount=0;
function Initad () {
if (!ns &&!ie &&!w3) return;
if (IE) addiv=eval (' Document.all.sponsorAdDiv.style ');
else if (NS) addiv=eval (' document.layers[' Sponsoraddiv "]);
else if (W3) addiv=eval (' document.getElementById (' Sponsoraddiv '). Style ');
Randad=math.ceil (Math.random () *chancead);
if (ie| | W3)
addiv.visibility= "visible";
Else
Addiv.visibility = "show";
if (randad==1) Showad ();
}
function Showad () {
if (adcount<adtime*10) {adcount+=1;
if (IE) {documentwidth =document.body.offsetwidth/2+document.body.scrollleft-20;
Documentheight =document.body.offsetheight/2+document.body.scrolltop-20;}
else if (NS) {documentwidth=window.innerwidth/2+window.pagexoffset-20;
documentheight=window.innerheight/2+window.pageyoffset-20;}
else if (W3) {documentwidth=self.innerwidth/2+window.pagexoffset-20;
documentheight=self.innerheight/2+window.pageyoffset-20;}
Addiv.left=documentwidth-200;addiv.top =documentheight-200;
SetTimeout ("Showad ()", 100);} else Closead ();
}
function Closead () {
if (ie| | W3)
Addiv.display= "None";
Else
Addiv.visibility = "Hide";
}
Onload=initad;
End-->
</script>
<div id= "Sponsoraddiv" style= "Visibility:hidden" >
<table bgcolor= "#008000" ><tr><td>
<table width= "bgcolor=" "#F0FFF0" ><tr><td align= "center" valign= "Middle" >
<p><b> Web Teaching Network welcome you to visit <br>
Please mention your valuable comments, thank you <br>
Your presence is the greatest support for US .</b>
</p>
<p> (This display area will be automatically closed in a few seconds)
<br>
</td></tr></table></td></tr></table>
</div>

</BODY></HTML>



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.