I have a small question regarding user input validation using JavaScript.
The following is the code that I wrote. It's working when this code does not have the 2nd validation. When I include the 2nd validation, even the first validation does not work.
Forget about that www.bbc.co.uk that I mentioned.
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
    /* first validation */
    var eml = document.forms["myForm"]["email"].value;
    if (eml == null || eml == "") {
        alert("Email Address must be filled out");
        return false;
    }
    /* second validation */
    var reg = /^([A-Za-z0-9._-])+@[A-Za-z0-9.-])+\.([A-Za-z]{2,4})$/;
    if (reg.test(document.forms["myForm"]["emaill"].value) == false) {
        alert("Invalid Email - Reg Function");
        document.getElementById("email").focus();
        return false;
    }
}
</script>
</head>
<body>
<form name="myForm" action="www.bbc.co.uk" onsubmit="return validateForm()" method="post">
    Email Address: <input type="text" name="email">
    <input type="submit" value="Submit">
</form>
</body>
</html>
 
     
     
     
    