java efficacy password, user name, unique efficacy

Remove the mouse to achieve the input box, immediately prompted to enter the content is available

 

The only well-tested user name

Input box

<p id="p"></p>
<input type="text" name="userName" id="userName">

js

< Script> 
the userName. The onblur = function () {

$. POST (
"/ ADMIN / isName",
{ username: the userName. Value, AEG: 18 is},
function (Data) {
. IF (Data code == "400") {
$ ( "# p1"). HTML ( "username is already registered, please re-enter!"). CSS ( "Color", "Red");
} the else {
$ ( "# p1"). HTML ( " username is available ").! CSS ( " Color ", " Green ");
}
});
};

</ Script>

 

Enter the password twice conformance-tested

Input box

<b id="warning" style="color: red"></b>
<input type="password" name="user.password" id="password">
<input type="password" name="repeatPassword" id="repeatPassword" onblur="check()">

js

<script>

function check(){
if(
document.getElementById("password").value!= document.getElementById("repeatPassword").value
) {
document.getElementById("warning").innerHTML=" 两次密码的输入不一致";
}else{
document.getElementById("warning").innerHTML=" ";
}
};
</script>

Username and password uniqueness check consistency checking implementation can be common.

Guess you like

Origin www.cnblogs.com/nnnnmmmm/p/11316280.html