jquery.validate.js的应用实例,自己写的有点简单
2011-04-18 23:26
519 查看
<form id="gform" name="gform" method="post" action="__URL__/adintromessage" enctype="multipart/form-data">
<table width="473" border="0" align="center">
<tr>
<td width="160" height="30" align="right" >姓名 <font color="red">*</font>:</td>
<td width="303">
<input type="text" name="hrr_name" id="hrr_name " />
</td>
</tr>
<tr>
<td width="160" height="30" align="right" >自荐职位 <font color="red">*</font>:</td>
<td width="303">
<input type="text" name="hrr_zijianjob" id="hrr_zijianjob" />
</td>
</tr>
<tr>
<td height="30" align="right" scope="row">性别 :</td>
<td>
<input name="hrr_mile" type="radio" id="guest_agent" style="width:12px;border:none;" value="男" checked="checked" />
男
<input type="radio" name="hrr_mile" value="女" id="guest_agent" style="width:12px; border:none;" />
女
</td>
</tr>
<tr>
<td height="30" align="right" scope="row">学历 <font color="red">*</font>:</td>
<td><input type="text" name="hrr_degree" id="hrr_degree" /></td>
</tr>
<tr>
<td height="30" align="right" scope="row">联系电话 <font color="red">*</font>:</td>
<td><input type="text" name="hrr_phone" id="hrr_phone" /></td>
</tr>
<tr>
<td height="30" align="right" scope="row">联系地址 <font color="red">*</font> :</td>
<td>
<input type="text" name="hrr_address" id="hrr_address" />
</td>
</tr>
<tr>
<td height="30" align="right" scope="row"><span>E-mail <font color="red">*</font>:</span></td>
<td><input type="text" name="hrr_email" id="hrr_email" /></td>
</tr>
<tr>
<td height="30" align="right" scope="row"><span>个人简介:</span></td>
<td>
<label>
<textarea name="hrr_experience" id="hrr_experience" cols="33" rows="8"></textarea>
</label>
</td>
</tr>
<tr>
<td height="30" align="right" valign="top" scope="row">简历上传:</td>
<td>
<input type="file" name="hrr_upload" id="hrr_upload" class="filebt"/><font color="#FF0000"></font>
</td>
</tr>
<tr>
<td height="30" align="right" valign="middle" scope="row"> </td>
<td valign="middle"><br/><input type="submit" name="button" id="button" value="提交" class="sbt"/>
<input type="reset" name="button2" id="button2" value="重置" class="sbt" /></td>
</tr>
</table>
</form>
-----------------------------------------------------------------------------------------------------------------------------
<script src="__PUBLIC__/js/jquery.validate.js" type="text/javascript"></script>
<script language='javascript'>
//表单验证
$(document).ready(function(){
$("#gform").validate({
onfocusout : false,
onkeyup : false,
rules: {
hrr_name : "required",
hrr_zijianjob : "required",
hrr_mile : "required",
hrr_degree : "required",
hrr_phone : "required",
hrr_address : "required",
hrr_email : "required",
hrr_experience : "required"
},
messages: {
hrr_name :"<font color='#FF0000'>用户名不能为空</font>",
hrr_zijianjob :"<font color='#FF0000'>用户名不能为空</font>",
hrr_mile :"<font color='#FF0000'>性别不能为空</font>",
hrr_degree :"<font color='#FF0000'>学历不能为空</font>",
hrr_phone :"<font color='#FF0000'>电话不能为空</font>",
hrr_address :"<font color='#FF0000'>电话不能为空</font>",
hrr_email :"<font color='#FF0000'>电子邮件不能为空</font>",
hrr_experience :"<font color='#FF0000'>个人简介不能为空</font>"
}
});
});
<table width="473" border="0" align="center">
<tr>
<td width="160" height="30" align="right" >姓名 <font color="red">*</font>:</td>
<td width="303">
<input type="text" name="hrr_name" id="hrr_name " />
</td>
</tr>
<tr>
<td width="160" height="30" align="right" >自荐职位 <font color="red">*</font>:</td>
<td width="303">
<input type="text" name="hrr_zijianjob" id="hrr_zijianjob" />
</td>
</tr>
<tr>
<td height="30" align="right" scope="row">性别 :</td>
<td>
<input name="hrr_mile" type="radio" id="guest_agent" style="width:12px;border:none;" value="男" checked="checked" />
男
<input type="radio" name="hrr_mile" value="女" id="guest_agent" style="width:12px; border:none;" />
女
</td>
</tr>
<tr>
<td height="30" align="right" scope="row">学历 <font color="red">*</font>:</td>
<td><input type="text" name="hrr_degree" id="hrr_degree" /></td>
</tr>
<tr>
<td height="30" align="right" scope="row">联系电话 <font color="red">*</font>:</td>
<td><input type="text" name="hrr_phone" id="hrr_phone" /></td>
</tr>
<tr>
<td height="30" align="right" scope="row">联系地址 <font color="red">*</font> :</td>
<td>
<input type="text" name="hrr_address" id="hrr_address" />
</td>
</tr>
<tr>
<td height="30" align="right" scope="row"><span>E-mail <font color="red">*</font>:</span></td>
<td><input type="text" name="hrr_email" id="hrr_email" /></td>
</tr>
<tr>
<td height="30" align="right" scope="row"><span>个人简介:</span></td>
<td>
<label>
<textarea name="hrr_experience" id="hrr_experience" cols="33" rows="8"></textarea>
</label>
</td>
</tr>
<tr>
<td height="30" align="right" valign="top" scope="row">简历上传:</td>
<td>
<input type="file" name="hrr_upload" id="hrr_upload" class="filebt"/><font color="#FF0000"></font>
</td>
</tr>
<tr>
<td height="30" align="right" valign="middle" scope="row"> </td>
<td valign="middle"><br/><input type="submit" name="button" id="button" value="提交" class="sbt"/>
<input type="reset" name="button2" id="button2" value="重置" class="sbt" /></td>
</tr>
</table>
</form>
-----------------------------------------------------------------------------------------------------------------------------
<script src="__PUBLIC__/js/jquery.validate.js" type="text/javascript"></script>
<script language='javascript'>
//表单验证
$(document).ready(function(){
$("#gform").validate({
onfocusout : false,
onkeyup : false,
rules: {
hrr_name : "required",
hrr_zijianjob : "required",
hrr_mile : "required",
hrr_degree : "required",
hrr_phone : "required",
hrr_address : "required",
hrr_email : "required",
hrr_experience : "required"
},
messages: {
hrr_name :"<font color='#FF0000'>用户名不能为空</font>",
hrr_zijianjob :"<font color='#FF0000'>用户名不能为空</font>",
hrr_mile :"<font color='#FF0000'>性别不能为空</font>",
hrr_degree :"<font color='#FF0000'>学历不能为空</font>",
hrr_phone :"<font color='#FF0000'>电话不能为空</font>",
hrr_address :"<font color='#FF0000'>电话不能为空</font>",
hrr_email :"<font color='#FF0000'>电子邮件不能为空</font>",
hrr_experience :"<font color='#FF0000'>个人简介不能为空</font>"
}
});
});
相关文章推荐
- jquery.validate.js简单实用实例
- jQuery.ajax的简单应用实例 附实例下载
- js综合应用实例简单的表格统计
- jQuery validate 根据 asp.net MVC的验证提取简单快捷的验证方式(jquery.validate.unobtrusive.js)
- jquery.validate.js 应用示例
- jquery.validate.js【简单实用的表单验证框架】
- jQuery validate 根据 asp.net MVC的验证提取简单快捷的验证方式(jquery.validate.unobtrusive.js)
- jquery.validate.js 应用示例
- js综合应用实例简单的表格统计
- jquery.validate.js 应用例子
- jquery.cycle.js简单用法实例
- Jquery使用(2):query.validate.js使用实例
- js 获取站点应用名的简单实例
- jquery.validate.js 的简单使用教程
- AJAX 的简单实例 (JS实现 和JQuery 实现)
- JS控制静态页面之间传递参数获取参数并应用的简单实例
- Jquery和JS用外部变量获取Ajax返回的参数值的方法实例(超简单)
- jquery.validate.js实例演示
- jquery 添加和移除节点 jquery 的简单实例应用
- jquery.validate.js【简单实用的表单验证框架】【进阶版】