Reset RequiredFieldValidator 重置 验证控件
<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>
posted on 2014-06-30 13:54 freeliver54 阅读(498) 评论(1) 编辑 收藏 举报