function isGoodEmail() {
var email = document.getElementById("<%=txtComapnyEmail.ClientID%>").value;
if (email == "Email") {
if (window.isValidEmail(email)) {
if (/(aol|gmail|yahoo|hotmail)\.com$/.test(email)) {
alert(' valid email, but not for this site. No free service emails!');
return false;
}
return true;
}
return false;
}
按钮代码:
<asp:Button runat="server" class="button-orange" Text="Confirm and start my company page"
ID="Companystart" OnClick="CompanystartClick" OnClientClick="isGoodEmail" />
我正在从按钮调用上面的 JavaScript,但它没有验证电子邮件。即使输入gmail
它也被接受。