jquery.validate.js的应用实例,自己写的有点简单

    技术2022-05-19  21

            <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>"

    }

    });

    });


    最新回复(0)