Hello gentlemen,
I have a problem with my GCSE coursework and I cant quite pinpoint the problem and was wondering if you guys could help me!
Here is my code!
I have a problem with my GCSE coursework and I cant quite pinpoint the problem and was wondering if you guys could help me!
Here is my code!
Code:
<head>
<title>Exam entry</title>
<script language="javascript" type="text/javascript">
function validateForm() {
var result = true;
var msg="";
var entry = document.querySelector('input[name="grade"]:checked').value;
var answer = confirm("You have chosen" + " " + entry + ", are you sure?");
var DG = Working;
DG+= '1';
if (document.ExamEntry.name.value=="") {
msg+="You must enter your name \n";
document.ExamEntry.name.focus();
document.getElementById('name').style.color="red";
result = false;
DG+= '2';
}
if (document.ExamEntry.subject.value=="") {
msg+="You must enter the subject \n";
document.ExamEntry.subject.focus();
document.getElementById('subject').style.color="red";
result = false;
DG+= '3';
}
if(answer){
alert("You have confirmed that you chosen" + " " + entry + "!");
DG+= '4';
}
else{
alert("Please change to appropriate entry!");
result = false;
DG+= '5';
}
if(document.ExamEntry.examno.value.length !== 4) {
msg+="You must enter a four digit examination number \n";
document.ExamEntry.examno.focus();
document.getElementById('examno').style.color="red";
result = false;
DG+= '6';
}
if(msg==""){
return result;
}
{
alert(msg);
DG+= '7';
return result;
alert(DG);
}
}
</script>
</head>
<body>
<h6 id="Debug">Working...</h6>
<h1>Exam Entry Form</h1>
<blockquote>
<blockquote>
<form name="ExamEntry" method="post" action="success.html">
<table width="52%" 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="examno">Examination Number</td>
<td><input name="examno" type="text" maxlength="4" /></td>
</tr>
<tr>
<td id="grade">Level of Entry</td>
<td>
<input type="radio" name="grade" id="GCSE" value="GCSE" checked="checked"/>GCSE
<input type="radio" name="grade" id="AS" value="AS"/>AS
<input type="radio" name="grade" id="A2" value="A2"/>A2</td>
</tr>
<tr>
<td></td>
<td><input align="right" type="submit" name="Submit" value="Submit" onClick="return validateForm();" /><input align="right" type="reset" name="Reset" value="Reset" /></td>
</tr>
</table>
</form>
</blockquote>
</blockquote>
</body>