Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<title>Login.html</title>
<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" >
<meta http-equiv= "description" content= "This are 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>
<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>
This is the login page, and the login is successful only if the user name is Lala and the password is 123. Use return at the OnClick event to block page jumps when user name and password input do not match. The Login Success page contains the number of seconds to wait, and the code is:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<title>ok.html</title>
<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" >
<meta http-equiv= "description" content= "This are 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 () {
Get MySpan value
$ (' MySpan '). innertext=$ (' MySpan '). innerText-1;
}
function $ (ID) {
return document.getElementById (ID);
}
var mytime = setinterval ("Changesec ()", 1000);
</script>
<body>
Login successful, <span id= "MySpan" >5</span> seconds to automatically jump to admin page
</body>
Key in the use of several functions, settimeout ("Tiao ()", 5000); The function is to open the page, wait 5 seconds, and invoke the Tiao () function. SetInterval ("Changesec ()", 1000); the function is the changesec () function called once every 1 seconds. This completes the simple login function.