下面是我的验证脚本。为什么输入电子邮件但不正确时不显示微型红色 X 图像?我被困住了。请帮忙!
<form name="validation" onSubmit="return checkbae()">
<input type="text" size=18 onkeyup="return checkbae()" name="email">
<span id="email" class="email"></span>
<input type="submit" value="Submit">
</form>
<script language="JavaScript1.2">
function checkemail() {
var messageg = document.getElementById('email');
var str = document.validation.email.value
var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z] {2})?)$/i
if (filter.test(str))
testresults = true
else {
messageg.style.color = red;
messageg.innerHTML = "\u2718"
testresults = false
}
return (testresults)
}
function checkbae() {
if (document.layers || document.getElementById || document.all)
return checkemail()
else
return true
}
</script>