Jump Timing js2--

<! DOCTYPE HTML> 
<HTML lang = "EN">
<head>
<Meta charset = "UTF-. 8">
<title> automatically jump </ title>
<style>
P {
text-align = left: Center;
}
span {
Color: Red;
}
</ style>
<Script>
/ *
* analysis:
* 1, display page <P>
2, the countdown number countdown effect
* 2.1 defines a method for obtaining a span content span tag body, time
* 2.2 defines a method of performing a one second timer
* 3, if the determination time <= 0, the process jumps to Home
*
* * /
var SECOND =. 5;
var
time = Document.getElementById("time");
Showtime function () {
// definition of a method of obtaining a span, modify the contents thereof span tags, event
second--;
IF (SECOND <= 0) {
the location.href = "https://www.baidu.com";
}

time.innerHTML SECOND + = "";
}
; the setInterval (Showtime, 1000)

</ Script>
</ head>
<body>
<P>
automatically jump after <span id = "time"> 5 seconds </ span> to Home. . .
</ P>
</ body>
</ HTML>

 

 

Guess you like

Origin www.cnblogs.com/soyadios/p/11963426.html