メールリセットページの形でフォームの検証を練習しようとしています。
これが私のコードです:
<!DOCTYPE html>
<html>
<head>
    <title>
        form validation
    </title>
    <script>
        function validateForm()
            {
                var email=document.forms["email_reset"]["user_email"].value;
                var atpos=email.indexOf("@");
                var dotpos=email.indexOf(".");
                var pass1=document.getElementByID("new_pwd");
                var pass2=document.getElementByID("confirm_pwd");
                if(atpos<1 || dotpos<atpos+2 || dotpos+2>=email.length) {
                    alert("Your email address is invalid!");
                    return false;
                }
                if(pass1 != pass2) {
                    alert("Your passwords do not match!");
                    return false;
                }
                else {
                    alert("Your password has been successfully reset!");
                }
            }
    </script>
</head>
<body>
    <form name="email_reset" onsubmit="validateForm()">
        <br />
        <font id="title" face="arial" color="white" size="2">[ Enter your email and new password below ]</font><br /><br />
        <label id="email_lab" color="white">Email Address:</label>
        <input type="text" class="input" name="user_email" id="user_email" maxlength="100" align="right"  /><br />
        <label id="newpass_lab" color="white">New Password:</label>
        <input type="password" class="input" name="new_pwd" id="new_pwd" maxlength="64" align="right"  /><br />
        <label id="confirmpass_lab" color="white">Confirm Password:</label>
        <input type="password" class="input" name="confirm_pwd" id="confirm_pwd" maxlength="64" align="right"  /><br />
        <input style="width: 25%; margin-bottom: 10px;" type="submit" class="input" id="sub_button" value="Submit" /><br />
    </form>
</body>
</html>
電子メールの入力が電子メールの形式と一致しない場合、およびパスワードの入力が同じではない場合に、警告ポップアップを表示したいと考えています。しかし、送信をクリックしても何も得られません。
このチュートリアルをガイドとして使用していました。どういうわけか、まだ何かが足りないと思います。