As shown below:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<style type= "Text/css" >
#main {border:1px solid black; width:200px;margin:0px auto;padding:100px;}
</style>
<script type= "Text/javascript" >
Window.onload = function () {
//The first invocation method, passing the method pointer
SetInterval (showmsg, 1000);
//The second method of invocation
var methodname = "showmsg ()"; Note that the string is used here, and parentheses are added
SetInterval (methodname, 1000); Double quotes, which indicate that the inside is code, will execute the code inside like SetInterval ("alert (' a ')", 1000), every 1 seconds to execute alert (' a ')
}
var seconds = 5;
function ShowMsg () {
if (seconds > 0) {
seconds--;
document.getElementById ("msg"). InnerHTML = seconds + "seconds after automatic shutdown!" ";
}
else {
Window.close ();
}
}
</script>
<body>
<div id= "Main" >
This is the ad form:
<div id= "msg" >5 seconds after automatic shutdown! </div>
</div>
</body>