<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript"> var time; window.onload = function(){ time = setTimeout ( " show () " , 2000 ); // start calling the show method after setting two seconds and a time to remember the return value of the setTimeout } function show(){ var img1 = document.getElementById("img1"); img1.style.display = " Block " ; // set a picture as display clearTimeout (time); // remove the original setTimeout settings, you can not write, because here are reassigned time = window.setTimeout ( " hide () " , 2000 ); call hide () method // hide picture after two seconds and the time to re-assignment. } function hide(){ var img1 = document.getElementById("img1"); img1.style.display = " none " ; // set a picture as hidden clearTimeout (time); // optional time = window.setTimeout ( " show () " , 2000 ); // two seconds after the call to show () method to display pictures, time and reassigned } </script> </head> <body> <img src="img3.jpg" id="img1" id="img1"> </body> </html>
javascript- advertising popups
Guess you like
Origin www.cnblogs.com/wwww2/p/12106621.html
Recommended
Ranking