我有以下代码,验证规则不起作用,请帮忙!Web 浏览器无法识别 javascript 代码,因为活动的 x 控件似乎没有出现。
<HTML>
<head>
<title>Exam entry</title>
<script lanuage="javascript" type="text/javascript">
var result = true;
function validateForm() {
var msg="";
if (document.ExamEntry.name.value=="") {
msg+="you must enter your name \n";
document.ExamEntry.name.focus();
document.getElementById('name').style.color="red";
result = false;
}
if (document.ExamEntry.subject.value=="") {
msg+("You must enter the subject \n");
document.ExamEntry.subject.focus();
document.getElementById('subject').style.color="red";
result false;
}
if (document.ExamEntry.ExaminationNumber.value=="") {
msg+("You must enter the Examination Number \n");
document.ExamEntry.ExaminationNumber.focus();
document.getElementById('ExaminationNumber').style.color="red";
result false;
}
if(msg==""){
return result;
}
{
alert(msg)
return result;
}
}
</script>
<form>
<input type="radio" name="qualification" value="GCSE">GCSE<br>
<input type="radio" name="qualification" value="AS">AS<br>
<input type="radio" name="qualification" value="A2">A2<br>
</form>
</head>
<body>
<h1>Exam Entry Form</h1>
<form name="ExamEntry" method="post" action="success.html">
<table width="50%" border="0">
<tr>
<td id="name">Name</td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td id="subject">Subject</td>
<td><input type="text" name="subject" /></td>
</tr>
<tr>
<td id="ExaminationNumber">ExaminationNumber</td>
<td><input type="text" name="ExaminationNumber" /></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit" onclick="return validateForm();" /></td>
<td><input type="reset" name="Reset" value="Reset" /></td>
</tr>
</table>
</form>
</body>
</HTML>
请有人帮忙,这让我发疯!