将电子邮件ID输入文本框并应用电子邮件验证,但似乎有一个错误,即在执行期间可能未调用整个函数
[Sun Jan 31 16:59:14.077148 2016] [core:alert] [pid 6492:tid 916] [client 127.0.0.1:63045] D:/lamp/www/forum/.htaccess: Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration, referer: http://forum.dev/core/install/install.php
[Sun Jan 31 17:17:38.028320 2016] [core:alert] [pid 6492:tid 916] [client 127.0.0.1:63417] D:/lamp/www/forum/.htaccess: Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration
[Sun Jan 31 17:17:38.191406 2016] [core:alert] [pid 6492:tid 916] [client 127.0.0.1:63418] D:/lamp/www/forum/.htaccess: Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration, referer: http://forum.dev/core/install/install.php
答案 0 :(得分:0)
可能您的功能正常工作,但即使在验证后页面也会提交,因此请在下面替换:
OnClientClick="javascript:IsValidUrl();"
与
OnClientClick="return javascript:IsValidUrl();"
修改强>
刚刚认为您的JS代码if (textbox.value.length > 0)
行中的错误应为if (emailbox.value.length > 0)
,请尝试替换它。
我在document.getElementById('<%=TextBox4.Text %>')
中发现的另一个问题应该是document.getElementById('<%=TextBox4.ID %>')
,如果使用母版页,则应该document.getElementById('<%=TextBox4.ClientID %>')
,所以请尝试替换它。
希望这会有所帮助!!
答案 1 :(得分:0)
javascript的IsValidURL功能似乎存在一些问题,请将其替换为以下代码。
function IsValidUrl()
{
var emailbox = document.getElementById('<%=TextBox4.ID %>');
var email = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if (emailbox.value.length > 0)
{
if (email.test(emailbox.value))
{
return true;
}
else
{
alert("Please enter valid Email");
return false;
}
}
else
{
alert("please enter text");
return false;
}
}
主要有两个问题
希望这会对你有所帮助。