<HTML> <Head> <title>JS implementation 5 Seconds Auto-close div ad Layer 丨 Auditorium seat 丨 Light partition board</title> <styletype= "Text/css"><!--#sponsorAdDiv{position:Absolute;Height:1;width:1;Top:0; Left:0;} -</style> </Head> <Body> <SCRIPTLANGUAGE= "JavaScript1.2">Adtime=5; //time to close window waitsChancead=1; varNS=(document.layers); varIE=(document.all); varW3=(document.getElementById&& !IE); Adcount=0; functionInitad () {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"; Elseaddiv.visibility="Show"; if(Randad==1) Showad (); } functionShowad () {if(Adcount<Adtime*Ten) {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- $; Addiv.top=Documentheight- $; SetTimeout ("Showad ()", -);}ElseClosead (); } functionClosead () {if(ie||W3) Addiv.display="None"; Elseaddiv.visibility="Hide"; } onload=Initad; </Script> <DivID= "Sponsoraddiv"style= "Visibility:hidden"> <Tablewidth= "The "Height= " the"bgcolor= "008000"><TR><TD> <Tablewidth= "445"Height= "345"bgcolor= "F0fff0"><TR><TD> <Center>Welcome to Www.csrcode.cn!<BR><BR>This window will automatically close after 5 seconds.</Center> </TD></TR></Table></TD></TR></Table></Div> </Body> </HTML> <BR><BR><HR>
JS implementation automatically closes the div ad layer for 5 seconds