jQuery EasyUI 的表单验证

<html><head><title></title>
<link style="text/css" rel="stylesheet" href="../参考资料/JQuery/jquery-easyui-1.1.2/themes/default/easyui.css">
<script src="jquery-1.4.2.min.js"></script>
<script src="jquery.easyui.min.js"></script>
<script>
$.extend($.fn.validatebox.defaults.rules, {
minLength: {
validator: function(value, param){
return value.length >= param[0];
},
message: '请输入至少(2)个字符.'
}
});


</script>
</head>

<body>

<form name="frmRegister" method="post">
<div style="width:500px;height:20px;">
name:<input name="txtName" class="easyui-validatebox"validType="minLength[3]" missingMessage="不能为空"  required="true" >

</div>
<div style="width:500px;height:20px;">
psw:<input name="txtPsw" type="password"  class="easyui-validatebox" validType="minLength[2]"  required="true">

</div>
<div style="width:500px;height:20px;">
address:<input name="txtAddr" class="easyui-validatebox"  validType="minLength[4]" invalidMessage="请输入至少4个字符" required="true">

</div>
<div style="width:500px;height:20px;">
email:<input name="txtEmail" validType="email" class="easyui-validatebox">
</div>
<div style="width:500px;height:20px;">
<input type="submit" value="注册">
</div>
</form>
</body>

</html>

猜你喜欢

转载自fendou-cheng.iteye.com/blog/1749717