全军出击
2016-11-07 12:13
<body>
<h1>欢迎登录我的博客网</h1>
<div id="bg">
<form id="login" action="" name="forms">
<h3>用户登录</h3>
<div id="inputs">
<lable for="username">账号<input id="username" type="text" name="Username" autofocus required></lable> <br/>
<lable for="username">密码<input id="password" type="password" name="password" required></lable>
</div>
<div id="actions">
<input type="button" id="submit" onClick="#" value="登录">
<input name="提交" type="submit" id="submit" onClick="javascript:location.href='file:///G:/%E5%AD%A6%E4%B9%A0/Untitled-zhuce.html'" value="我要注册">
</div>
</form>
</div>
<script src="../lib/jquery.js"></script>
<script src="../lib/jquery.mockjax.js"></script>
<script src="../lib/jquery.form.js"></script>
<script src="../dist/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#login").validate({
rules:{
username:{
required:true
minlength:2
maxlength:10
},
password:{
required:true
minlength:2
maxlength:16
}
},
messages:{
username:{
required:"必须填写用户名"
minlength:"用户名最小为2"
maxlength:"用户名最大为10"
},
password:{
required:"必须填写密码"
minlength:"密码最小为2"
maxlength:"密码最大为16"
}
}
})
});
</script>
</body>
name="Username" 你的name是 大写的 jquery你写的 小写 当然不能验证了,验证是通过name属性来验证的
jQuery插件——Validation Plugin
65871 学习 · 216 问题
相似问题