<form onsubmit="return checkForm()">
<input type="password" name="password" id="password"/>
</form>
<script>
function checkForm(){
if(document.getElementById("password").value.length<6){
alert("Password length must large the 6");
return false;
}
return true;
}
</script>
<input type="password" name="password" id="password"/>
</form>
<script>
function checkForm(){
if(document.getElementById("password").value.length<6){
alert("Password length must large the 6");
return false;
}
return true;
}
</script>
<input type="password" name="password" id="password" onBlur="checkPassword()"/>
</form><script>
function checkPassword(){
if(document.getElementById("password").value.length<6){
alert("Password length must large the 6");
document.getElementById("password").focus();
return false;
}
return true;
}
</script>当password失去焦点的时候调用那个检测程序,当然function就换一个名字吧,不经不是checkForm了!