JS Implementation Login Interface

Source: Internet
Author: User

Code share:

<!doctype html>

<meta charset= "UTF-8" >
<title>Document</title>
<style>
input[type]{
border:1px solid Darkorange;
Background:white;
}
#button {
border:10px solid Orange;
width:200px;
box-shadow:0px 4px 5px #666;
Background:orange;
Color:white;
}
</style>

<body>
<center>
<div>
<form>

<p> Username: <input type= "text" id= "name" placeholder= "please fill in User name" required= "required" onblur= "name1 ()" <!-- Onfocus= "name2 ()--" ><br><span id= "Tel" ></span></p>
<p> Password: <input id= "paswd" type= "password" placeholder= "please fill in the password" onblur= "Pwd1 ()" required= "Required" onfocus= " PWD2 () "><br><span id=" PW "></span></p>
<p> Confirm Password: <input id= "paswd2" type= "password" placeholder= "Please Confirm password" required= "required" onkeyup= "Validate ()" ><br><span id= "QPWTX" ></span></p>
<p> Email: <input type= "email" placeholder= "please fill in the email" required= "required" ></p>
<p><input type= "checkbox" required= "required" > I have read the registration manual </p>
<p><input type= "Submit" id= "button" value= "register" ></p>
</form>
</div>
</center>
</body>
<script>
function name1 () {
var Name=document.getelementbyid ("name"). Value;
if (name.length== "") {
document.getElementById ("tel"). innerhtml= "User name cannot be empty"
document.getElementById ("tel"). style.color= "Red";
}else{
document.getElementById ("tel"). Innerhtml= "√"
document.getElementById ("tel"). style.color= "Green";
}
}
function Pwd2 () {
document.getElementById ("PW"). Innerhtml= "Please fill in the 6-12-digit password"
document.getElementById ("PW"). style.color= "#999";

}
function Pwd1 () {
P=document.getelementbyid ("paswd"). Value;

if (p.length>=6&&p.length<=20)
{
document.getElementById ("PW"). Innerhtml= "√"
document.getElementById ("PW"). style.color= "Green";
}else{
document.getElementById ("PW"). Innerhtml= "Format error, please enter 6-20-bit"
document.getElementById ("PW"). style.color= "Red";
}
}
function Validate () {
var Qpw=document.getelementbyid ("paswd"). Value;
var Qpw2=document.getelementbyid ("Paswd2"). Value;

if (qpw==qpw2 && p.length>=6&&p.length<=20) {
document.getElementById ("Qpwtx"). Innerhtml= "<font color= ' green ' >√</font>";
document.getElementById ("button"). Disabled = false;
}
else {
document.getElementById ("Qpwtx"). Innerhtml= "<font color= ' red ' > two times password is not the same or format error </font>";
document.getElementById ("button"). Disabled = true;
}
}
</script>

Effect:

JS Implementation Login Interface

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.