$('#p0 1 ')。 empty();
})
$("#psd ")。 focus(function(){
$('#p02 ')。 empty();
});
$("#tel ")。 focus(function(){
$('#p03 ')。 empty();
});
Function? checkUser()? {
var? Lei Gesi? =? /^[a-za-z0-9_-]{4, 16}$/;
var? User? =? $(' # user ');
If (? $ ("# user"). val()。 Length? ==? 0? ){
$("#p0 1 ")。 Html ("Account cannot be empty");
$("#p0 1 ")。 Css ("color", "red");
Return? Fake;
} something else? if(reguser . test(user . val()){
$("#p0 1 ")。 Html ("User name entered correctly");
$("#p0 1 ")。 Css ("color", "blue");
Return? True;
} Otherwise {
$("#p0 1 ")。 Html ("User name is 4- 16 letters, numbers, underscores and minus signs");
$("#p0 1 ")。 Css ("color", "red");
Return? Fake;
}
}
Function? checkTel()? {
var? regtel? =? /^ 1[3|4|5|7|8][0-9]{9}$/;
var? Telephone? =? $(' # tel ');
If (? $("#tel ")。 val()。 Length? ==? 0? ){
$("#p03 ")。 Html ("number cannot be empty");
$("#p03 ")。 Css ("color", "red");
Return? Fake;
} something else? if(regtel . test(tel . val()){
$("#p03 ")。 Html ("Mobile phone number entered correctly");
$("#p03 ")。 Css ("color", "blue");
Return? True;
} Otherwise {
$("#p03 ")。 Html ("Please enter the correct mobile phone number");
$("#p03 ")。 Css ("color", "red");
Return? Fake;
}
}
Function? checkPassword()? {
var? regpsda? =/[0-9 | A-Z | A-Z]/;
var? regpsdb? =/^[a-za-z]+$/; ? //The password strength design is not rigorous enough.
var? regpsdc? =/[^0-9a-za-z]/;
var? psd? =? $(' # PSD ');
If (? $("#psd ")。 val()。 Length? ==? 0? ){
$("#p02 ")。 Html ("Password cannot be empty");
$("#p02 ")。 Css ("color", "red");
Return? Fake;
} something else? if(reg psda . test(PSD . val()){
$("#p02 ")。 Html ("low password strength");
$("#p02 ")。 css("color "," Indian red ");
Return? True;
} something else? if(regpsdb . test(PSD . val()){
$("#p02 ")。 Html ("password strength in progress");
$("#p02 ")。 Css ("color", "chocolate");
Return? True;
} something else? if(regpsdc . test(PSD . val()){
$("#p02 ")。 Html ("strong password");
$("#p02 ")。 Css ("color", "green");
Return? True;
} Otherwise {
$("#p02 ")。 Html ("alphanumeric combination of password bits 6- 12");
$("#p02 ")。 Css ("color", "red");
Return? Fake;
}
}
$('#btn ')。 On ('click', function? ()? {
var? user = check user();
var? tel = check tel();
var? PSD = check password();
If (user? & amp& amp? Telephone? & amp& amp? psd){
Alert ('Submit');
} something else? {
Alarm ("wrong padding");
}
}); If you rewrite it, you can directly replace it with your own judgment logic, but the password strength needs to be measured by yourself. For example, if the password strength is weak, it will not be submitted.
Or what? if(reg psda . test(PSD . val()){
$("#p02 ")。 Html ("low password strength");
$("#p02 ")。 css("color "," Indian red ");
Return? True;
} This return is changed to false. When submitting the form, change alert ('submit') to $('#form'). submit();