I don't know why the regex patterns was not working ! I couldn't find any error ! But when i run this with wrong input it just skips the pattern test line and moves to the next page !
<!DOCTYPE html>
<html>
<head>
    <title>Validation</title>
    <script>
        function validate()
        {
            var email=document.myform.email.value;
            var pass=document.myform.pass.value;
            var phno=document.myform.phno.value;
            if(email!="" && pass!="" && phno!="")
            {
                var emailcheck=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
                var passcheck=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}/;  
                var phonecheck=/^[0-9]{10}+$/;
                var result1=emailcheck.test(email);
                var result2=passcheck.test(pass);
                var result3=phonecheck.test(phno);
            }
            else
            {
                alert("Validation failed");
                return false;
            }
            if(result1 && result2 && result3)
            {
                alert("Validation Successful");
                //return true;
            }
            else
            {
                    alert("Validation Failed");
                    document.write("email should be as (xxx@gmail.com)"+"<br/>"+"password should be as (pass123)"+"<br/>"+"phone should be as (98659-57575)"+"<br/>");
                    return false;
            }
        }
    </script>
</head>
<body>
    <form name="myform" action="number.php" onsubmit="return validate()">
    Email:<input type="text" name="email"/><br/>
    Password:<input type="text" name="pass"/> <br/>
    Phone:<input type="text" name="phno"/> <br/>
    <input type="submit" value="submit"/>
    </form>
</body>
</html>
I expect the alert validation failed, if I give any input that mismatch the pattern.
 
    