验证输入的邮箱是否正确
前端:
<td height="28" align="right">电子邮箱:</td>
<td align="left" colspan="3">
<input runat="server" id="Email" name="Email" class="admin_index" title="电子邮箱" onchange="checksEmail()"/><span style="color: red">*</span>
</td>
js:
<script>
function checksEmail() {
var Email_Data = $("#Email").val();
if (!(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(Email_Data)))
alert("邮箱输入有误");
document.getElementById("Email").focus();
}
</script>