<input id="my_file_element" type="file" size="20" runat="server" />
<asp:CustomValidator ID="CustomValidatorFile" runat="server" ClientValidationFunction="FileCheck" ControlToValidate="my_file_element" ErrorMessage="*"></asp:CustomValidator> function FileCheck(source, arguments) {
var str = document.getElementById("<%=my_file_element.ClientID %>").value;
alert("test");
if (str == "") {
arguments.IsValid = false;
}
else {
arguments.IsValid = true;
}
}为什么非空验证不管用啊,alert没有弹框,好像这个js没有执行
<asp:CustomValidator ID="CustomValidatorFile" runat="server" ClientValidationFunction="FileCheck" ControlToValidate="my_file_element" ErrorMessage="*"></asp:CustomValidator> function FileCheck(source, arguments) {
var str = document.getElementById("<%=my_file_element.ClientID %>").value;
alert("test");
if (str == "") {
arguments.IsValid = false;
}
else {
arguments.IsValid = true;
}
}为什么非空验证不管用啊,alert没有弹框,好像这个js没有执行
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货