<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>
密码匹配密码确认 html5 验证检查自带检查
最新推荐文章于 2022-03-03 00:43:10 发布