
http://www.html5rocks.com/en/tutorials/forms/html5forms/
<label>Password:</label><input type="password" ID="password" name="password"><label>Confirm Password:</label><input type="password" ID="passwordconf" name="passwordconf" oninput="check(this)"><script language='JavaScript' type='text/JavaScript'>function check(input) { if (input.value != document.getElementByID('password').value) { input.setCustomValIDity('The two passwords must match.'); } else { // input is valID -- reset the error message input.setCustomValIDity(''); }}</script> @H_502_2@通过将它添加到您的CSS(下图)来使其变幻莫测.当HTML5验证失败时,它会在不利的输入字段周围放置一个红色的边框. :invalID { border: 2px solID #ff0000;} @H_502_2@全做完了.您仍然应该使用alert()或服务器端验证来确保用户正确输入两个密码.不要依靠客户端任何东西. 总结 以上是内存溢出为你收集整理的表单 – HTML5验证全部内容,希望文章能够帮你解决表单 – HTML5验证所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)