请建议我如何编写java脚本代码,为文本框指定必需的字段验证器,而不使用asp.net中内置的必需验证器功能
答案 0 :(得分:0)
你可以尝试这样的事情:
function ValidateInput() {
var validationMessage = "Your Txt is not valid";
var isValid = true;
if (document.getElementById('<%= txt.ClientID %>').value = '') {
// update the message
isValid = false;
}
if (!isValid)
alert(validationMessage);
return false;
}