How to log on to the system using JS

Source: Internet
Author: User

When the user enters the pwd password 123, the page jumps to the second page. After 4 seconds, the page automatically jumps to the third page.
Login.html
Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Script type = "text/javascript">

// Check
Function check (){
// Window. alert ($ ("username"). value );
If ($ ("username"). value = "pwd" & $ ("pwd"). value = "123 "){
Return true;
} Else {
$ ("Username"). value = "";
$ ("Pwd"). value = "";
Return false;
}
}
// Obtain the Document Object
Function $ (id ){
Return document. getElementById (id );
}
</Script>
</Head>
<Body>
<Form action = "OK .html">
U: <input type = "text" id = "username"/> <br/>
P: <input type = "password" id = "pwd"/> <br/>
<Input type = "submit" value = "submit" onclick = "return check ()"/>
</Form>
</Body>
</Html>

OK .html
Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Script type = "text/javascript">

// Jump to the specified page
Function tiao (){
ClearInterval (myInterval );
Window. open ("success.html", "_ self ");
}
// Set the jump in 5 seconds
SetTimeout ("tiao ()", 5000 );

// Change the number of seconds
Function changeSec (){
// Change the number
$ ("Myspan"). innerText = parseInt ($ ("myspan"). innerText)-1;
}

Var myInterval = setInterval ("changeSec ()", 1000 );

// Obtain the object
Function $ (id ){
Return document. getElementById (id );
}
</Script>
</Head>
<Body>
Log On <span id = "myspan"> 5 </span> seconds after successful logon.
</Body>
</Html>

Success.html
Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Script type = "text/javascript">

</Script>
</Head>
<Body>
Welcome .......
</Body>
</Html>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.