正则表达式
正则表达式
https://www.runoob.com/js/js-regexp.html 基础
https://www.cnblogs.com/alex-hrg/p/9617294.html 例子
http://caibaojian.com/jquery/regexp.html 速查表
表单验证
<form id="formSub" action="xxx.html" method="get">
<div>
用户名:<input type="text" wxy="用户名4-8位" id="username" name="username" placeholder="请输入用户名"/>
<span></span>
</div>
<div>
密码:<input type="password" wxy="密码长度6-10位" id="userpwd" name="userpwd" />
<span></span>
</div>
<input type="submit" value="注册" />
</form>
控制登录验证:
方法一:给表单form添加id,绑定提交方法
<script>
$(function(){
$("#formSub").submit(function(){
alert("进入方法……");
return true; //返回true注册成功
});
});
</script>
方法二:提交按钮在表单外,是一个普通的按钮,绑定单击事件到表单上
<input type="button" value="注册" />
<script>
$("input[type='button']").click(function(){
("#formSub").submit();
});
</script>