<! DOCTYPE html>
<meta charset= "UTF-8" >
<TITLE>HTML5 page using JavaScript validation form judgment input </title>
<script language= "JavaScript" >
function Check () {
var Pass1=document.getelementbyid ("Pass1");
var Pass2=document.getelementbyid ("Pass2");
if (Pass1.value!=pass2.value) {
Pass2.setcustomvalidity ("Inconsistent password");
Else
Pass2.setcustomvalidity ("");
}
var Email=document.getelementbyid ("email");
if (!email.checkvalidity ())
Email.setcustomvalidity ("Please enter the correct email address");
}
</script>
<form id= "Testform" onsubmit= "return Check ()" >
Password: <input type= "password" name= "Pass1" id= "Pass1"/><br/>
Confirm Password: <input type= "password" name= "Pass2" id= "Pass2"/><br/>
Email:<input type= "Email" name= "email" id= "email"/><br/>
<input type= "Submit"/>
</form>
Html5 page use JavaScript setcutomvalidity () function to validate form judgment input