通过javascript自定义验证程序错误文本?
我想通过客户端javascript设置ASP.net自定义验证程序错误参数文本。如何通过“我的函数”中的sender、args参数访问它?只需在CustomValidator定义的属性中定义回调方法:通过javascript自定义验证程序错误文本?,javascript,asp.net,asp.net-2.0,Javascript,Asp.net,Asp.net 2.0,我想通过客户端javascript设置ASP.net自定义验证程序错误参数文本。如何通过“我的函数”中的sender、args参数访问它?只需在CustomValidator定义的属性中定义回调方法: <asp:CustomValidator id="CustomValidator1" ... ClientValidationFunction="ClientValidationFunction" /> 您只需在CustomValidator定义的属性中定义回调方法:
<asp:CustomValidator id="CustomValidator1"
...
ClientValidationFunction="ClientValidationFunction" />
您只需在CustomValidator定义的属性中定义回调方法:
<asp:CustomValidator id="CustomValidator1"
...
ClientValidationFunction="ClientValidationFunction" />
这对我很有用:
var clientValidationFunction = function(sender, args) {
sender.textContent = sender.innerText = sender.innerHTML = "My new error text";
// etc...
};
我只是查看了sender对象,并用新的错误字符串替换了当前出现的所有错误字符串。这对我很有效:
var clientValidationFunction = function(sender, args) {
sender.textContent = sender.innerText = sender.innerHTML = "My new error text";
// etc...
};
我刚刚查看了sender对象,并用新的错误字符串替换了当前出现的所有错误字符串。谢谢Dexter,我想知道如何通过javascript设置验证器的错误消息参数。您的示例中的“源”是什么?抱歉-应该是
sender
谢谢Dexter,我想知道如何通过javascript设置验证器的错误消息参数。您的示例中的“源”是什么?抱歉-它应该是sender
另请参见