Copy codeThe Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Title> Login.html </title>
<Meta http-equiv = "keywords" content = "keyword1, keyword2, keyword3">
<Meta http-equiv = "description" content = "this is my page">
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<! -- <Link rel = "stylesheet" type = "text/css" href = "./styles.css"> -->
<Script type = "text/javascript">
Function checkuser (){
If ($ ('uname' = "lala") & $ ('pwd') = "123 "){
Return true;
} Else {
Return false;
}
}
Function $ (id ){
Return document. getElementById (id). value;
}
</Script>
</Head>
<Body>
<Form action = "OK .html">
U: <input type = "text" id = "uname"/> <br>
P: <input type = "password" id = "pwd"/> <br>
<Input type = "submit" value = "login" onclick = "return checkuser ()"/>
</Form>
</Body>
</Html>
This is the logon page. The logon is successful only when the user name is lala and the password is 123. Use return in The onclick event to prevent page Jump when the user name and password do not match. The logon success page contains the waiting seconds. The Code is as follows:
Copy codeThe Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Title> OK .html </title>
<Meta http-equiv = "keywords" content = "keyword1, keyword2, keyword3">
<Meta http-equiv = "description" content = "this is my page">
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<! -- <Link rel = "stylesheet" type = "text/css" href = "./styles.css"> -->
<Script type = "text/javascript">
Function tiao (){
ClearInterval (mytime );
Window. open ("manage.html", "_ self ");
}
SetTimeout ("tiao ()", 5000 );
Function changeSec (){
// Obtain the myspan value.
$ ('Myspan '). innerText = $ ('myspan'). innerText-1;
}
Function $ (id ){
Return document. getElementById (id );
}
Var mytime = setInterval ("changeSec ()", 1000 );
</Script>
</Head>
<Body>
Log on successfully. <span id = "myspan"> 5 </span> seconds later, the page is automatically displayed.
</Body>
</Html>
The key lies in the use of several functions. setTimeout ("tiao ()", 5000); the function is to open the page and wait for 5 seconds to call the tiao () function. SetInterval ("changeSec ()", 1000); the function calls the changeSec () function once every one second. This completes the simple login function.