Timing pages pop-up ads
<! DOCTYPE HTML > < HTML > < head > < Meta charset = "UTF-. 8" > < title > </ title > < Script > / * *. 1 determines that the event * 2 event to trigger the function the init () *. 3 the init function which make an event: * = 1 starts a timer: setTimout () * 2 show one ad * closes the ad * / function hideAD () { // first obtain img need to operate var img = document.getElementById ( "img1"); // then hide img.style.display = " none " ; } function showAD () { // first acquired img need to operate var img = document.getElementById ( " IMG1 " ); // show ads img.style .display = " Block " ; // then turn off the timer advertising the setTimeout ( " hideAD () " , 3000 ); } function the init () { the setTimeout ("showAD()",3000); } </script> </head> <body onload="init()"> <img src="img/image/3.jpg" id="img1" width="100%" height="30%" style="display: none;" /> <img src="img/image/1.jpg" /> </body> </html>
Home pop-up ads
<! DOCTYPE HTML > < HTML > < head > < Meta charset = "UTF-8" > < title > </ title > < Script > // When we open the web, through a pop-up ad 5s bell. Let us automatically hide after watching 5s. function hideImg () { var IMG = document.getElementById ( " IMG1 " ); img.style.display = " none " ; show(){ var img=document.getElementById("img1"); img.style.display="block";//图片的显示 } </script> </head> <body> <input type="button" value="显示" onclick="show()" /> <input type="button" value="隐藏" onclick="hideImg()" /><br /> <img src="img/attack/z_1_attack_03.png" id="img1" /> </body> </html>