I need to add three radio buttons to this. One for GCSE, AS, A2. aND put level of entry beside the radio buttons.
Here is the code:
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<title>Exam entry</title>
<style>
.redText {
color: #CC1414;
}
h1 {
text-align: center;
}
form {
margin: 0 auto;
width: 19em;
}
label {
display: inline-block;
width: 10em;
vertical-align: middle;
}
input[name=”txtExaminationNumber”] {
width: 2.5em;
}
</style>
<script>
function validateForm() {
var result = true,
msg = “”;
if (ExamEntry.name.value === “”) {
msg+=”You must enter your name n”;
document.ExamEntry.name.focus();
document.getElementById(“name”).classNam… = “redText”;
result = false;
} else {
document.getElementById(“name”).classNam… = “”;
}
if (ExamEntry.subject.value === “”) {
msg += “You must enter the subject n”;
document.ExamEntry.subject.focus();
document.getElementById(“subject”).class… = “redText”;
result = false;
} else {
document.getElementById(“subject”).class… = “”;
}
if (isNaN(ExamEntry.txtExaminationNumber.va… ||
ExamEntry.txtExaminationNumber.value === “” ||
ExamEntry.txtExaminationNumber.value.len… > 4 ||
ExamEntry.txtExaminationNumber.value.len… > 4) {
msg += “You must enter a valid examination number. 4 numbers only n”;
document.ExamEntry.txtExaminationNumber.…
document.getElementById(“elExamNumber”).… = “redText”;
result = false;
} else {
document.getElementById(“elExamNumber”).… = “”;
}
if (msg === “”) return result;
alert(msg);
return result;
}
</script>
</head>
<body>
<h1>Exam Entry Form</h1>
<form name=”ExamEntry” method=”post” action=”success.html”>
<table>
<tr>
<td id=”name”><label for=”f1″>Name</label></td>
<td><input type=”text” name=”name” id=”f1″></td>
</tr>
<tr>
<td id=”elExamNumber”><label for=”f2″>Examination Number</label></td>
<td><input type=”text” name=”txtExaminationNumber” id=”f2″></td>
</tr>
<tr>
<td id=”subject”><label for=”f3″>Subject</label></td>
<td><input type=”text” name=”subject” id=”f3″></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>
Thanks. I will give 10point to anyone who doese this for me
✅ Answers
? Best Answer