密码并确认密码验证

password and confirm password validation

我想验证密码和确认密码字段。已完成密码验证 mismatch.Now 我要验证,用户必须输入 8 到 15 之间的密码和混合符号、字符、数字

<form id="form" action="" method="post">
<label for="pass">Password</label>
<input type="password" id="pass" class="text" name="your_pass" value="" onblur="passchk()"/>
<label for="c_pass">Confirm Password</label>
<input type="password" id="c_pass" class="text" name="your_c_pass" value="" onblur="confirmPass()"/><br>
<span id="error" style="color:#F00;"> </span>

JS:

function confirmPass() {
    var pass = document.getElementById("pass").value
    var confPass = document.getElementById("c_pass").value
    if(pass != confPass) {
        //alert('Wrong confirm password !');
        document.getElementById('error').innerHTML='wrong confirm password';
    }
    else
    {
        document.getElementById('error').innerHTML='';
    }
}


function passchk(){
    alert('hi');

}

8到15个字符,只包含字符、数字、下划线和第一个字符必须是字母

function CheckPassword(input)   
{   
    var pass=  /^[A-Za-z]\w{8,15}$/;  
    if(input.value.match(pass))   
    {     
        return true;  
    }  
        else  
    {   
        alert('Password Is Not Valid')  
        return false;  
    }  
}