weiceshi
2015-09-15 10:31:48 +08:00
槽点太多,不知道如何吐起
1 ,首先是你的正则表达式,.{0}|.{6,20},这是什么意思啊,匹配空字符或者 6-20 长度的任意字符?你自己念念,能念通吗?
2 ,其次 pattern 不应该处理空字符
The empty string is considered valid (no misMatch ) unless the required attribute is present as well (valueMissing ).
3 , required="" ......
4 , ie 从 10 开始就支持 pattern 了,不完全支持 input pattern 的移动浏览器包括 android 和 mobile Safari ,而桌面浏览器只有 Safari Safari Safari
Android, Safari and Mobile Safari support the pattern attribute, but do not support form validation, so will not prevent an incorrect value from being submitted, but do support the UI pseudoclasses.
最后,你的这段修改如下:
<input name="password" title="长度要求在 6-20 位" class="Text_Box" id="reg_userpass1" required type="password" size="40" pattern=".{6,20}">