密码匹配密码确认 html5 验证检查自带检查

  <form target="_blank" autocomplete="on">
        <label for="gm_mail">贵美网站邮箱:</label>
        <input type="text" required id="gm_mail" name="gm_mail">
        <br>
        <label for="gm_pass">输入密码:</label>
        <input type="password" required id="gm_pass" name="gm_pass">
        <br>
        <label for="gm_confirm_pass">确认密码:</label>
        <input type="password" required id="gm_confirm_pass" name="gm_confirm_pass">
        <br>
        <input type="radio" checked name="contact_version">豪华版</input>
        <input type="radio" name="contact_version">简洁版</input>
        <!-- name 相同时是单选 -->
        <br>
        <input type="checkbox">自动登录</input>
        <input type="checkbox">安全登录</input>
        <br>
        <br>
        <input type="reset" value="重置" />
        <input type="submit" value="登录" />
        <br>
        <br>
        <input type="button" value="现在就注册">
    </form>
    <script>
        var password = document.getElementById("gm_pass")
            , confirm_password = document.getElementById("gm_confirm_pass");

        function validatePassword() {
            if (password.value != confirm_password.value) {
                confirm_password.setCustomValidity("Passwords Don't Match");
            } else {
                confirm_password.setCustomValidity('');
            }
        }

        password.onchange = validatePassword;
        confirm_password.onkeyup = validatePassword;
    </script>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值