我已经有了代码,但它没有成功运行。按提交时没有弹出窗口。感谢您提前协助
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Email Validation</title>
</head>
<body>
<script>
function ValidateEmail(mail)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value))
{
return (true)
}
alert("You have entered an invalid email address!")
return (false)
}
</script>
<table>
<tr>
<td> Email </td>
<td> <input type = 'text' name = 'email' size = '30' />
</td>
</tr>
</table>
<input type="submit" value="Submit" onclick = "ValidateEmail()">
</body>
</html>
答案 0 :(得分:0)
onclick="ValidateEmail()"
- 记住你必须调用函数