首页 > 学院 > 开发设计 > 正文

ResetRequiredFieldValidator重置验证控件

2019-11-14 16:36:31
字体:
来源:转载
供稿:网友

<td style="width:100px;">姓名<span class="must_star">*</span></td>
   <td>
    <asp:TextBox ID="txtNAME" runat="server" MaxLength="60"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"  ForeColor="Red"   Display="Dynamic"
    ControlToValidate="txtNAME" ErrorMessage="请输入姓名"></asp:RequiredFieldValidator>
    </td>
  </tr>

 

 

<input id="Reset1" type="reset" value="重置" class="button_blue" onclick="resetForm();" />

 

 

<script type="text/javascript">

  function resetForm() {
   //alert("test if function gets fired");
   document.forms[0].reset();
   for (i = 0; i < Page_Validators.length; i++) {
    //    Page_Validators[i].style.visibility = 'hidden';
    Page_Validators[i].style.display = 'none'; //for  Display="Dynamic"
   }
   return false;
  }

</script>

 


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表