I am trying to write a test form for my site, and I can't get the script to work. I am just starting with JavaScript, and I am probably making a lot of mistakes, so please help. For some reason, the alert boxes won't appear when the form is submitted. The entire HTML code with script is as follows:
<html>
<head>
<title>The Page of the Web Design Quiz</title>
<link rel="STYLESHEET" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"../radioactive/rrrcss.css">
<script language="JavaScript">
function ansAdd() {
var a = 0; {
if (form.font.value = "true") {
a++
} if (form.ftp.value = "true") {
a++
} if (form.acro.value = "true") {
a++
} if (a = 3) {
alert("You got a perfect score!")
} else {
alert("Not quite perfect.")
}
}
}
</script>
</head>
<body bgcolor=#000000><font color=#00CCFF>
<br><br><br><br>
<form>
<table border=10 bordercolor=#000000 width=100%>
<tr>
<td width=50% colspan=2>
<font face="Courier New">
<b>1. What font is this question written in?</b></font>
</td>
<td width=50% colspan=2>
<b>2. What does FTP stand for?</b>
</td>
</tr>
<tr>
<td width=25%>
<font size=-1>
Courier<br>
Century Gothic<br>
Courier New<br>
Fixedsys
</font>
</td>
<td width=25%>
<input type="radio" name="font" value="false"><br>
<input type="radio" name="font" value="true"><br>
<input type="radio" name="font" value="false"><br>
<input type="radio" name="font" value="false">
</td>
<td width=25%>
<font size=-1>
Fat Tuesday Party<br>
Fan Tan Pan<br>
Folder Test Procedure<br>
File Transfer Protocol
</font>
</td>
<td width=25%>
<input type="radio" name="ftp" value="false"><br>
<input type="radio" name="ftp" value="false"><br>
<input type="radio" name="ftp" value="false"><br>
<input type="radio" name="ftp" value="true">
</td>
</tr>
<tr>
<td width=50% colspan=2>
<b>Which of these is not an <u>internet</u> acronym?</b>
</td>
</tr>
<tr>
<td width=25%>
YMCA<br>
HTTP<br>
URL<br>
CGI
</td>
<td width=25%>
<input type="radio" name="acro" value="true"><br>
<input type="radio" name="acro" value="false"><br>
<input type="radio" name="acro" value="false"><br>
<input type="radio" name="acro" value="false">
</td>
</tr>
</table>
<input type="submit" name="submit" value="SUBMIT THE TEST" onClick="ansAdd()">
</form>
<html>
<head>
<title>The Page of the Web Design Quiz</title>
<link rel="STYLESHEET" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"../radioactive/rrrcss.css">
<script language="JavaScript">
function ansAdd() {
var a = 0; {
if (form.font.value = "true") {
a++
} if (form.ftp.value = "true") {
a++
} if (form.acro.value = "true") {
a++
} if (a = 3) {
alert("You got a perfect score!")
} else {
alert("Not quite perfect.")
}
}
}
</script>
</head>
<body bgcolor=#000000><font color=#00CCFF>
<br><br><br><br>
<form>
<table border=10 bordercolor=#000000 width=100%>
<tr>
<td width=50% colspan=2>
<font face="Courier New">
<b>1. What font is this question written in?</b></font>
</td>
<td width=50% colspan=2>
<b>2. What does FTP stand for?</b>
</td>
</tr>
<tr>
<td width=25%>
<font size=-1>
Courier<br>
Century Gothic<br>
Courier New<br>
Fixedsys
</font>
</td>
<td width=25%>
<input type="radio" name="font" value="false"><br>
<input type="radio" name="font" value="true"><br>
<input type="radio" name="font" value="false"><br>
<input type="radio" name="font" value="false">
</td>
<td width=25%>
<font size=-1>
Fat Tuesday Party<br>
Fan Tan Pan<br>
Folder Test Procedure<br>
File Transfer Protocol
</font>
</td>
<td width=25%>
<input type="radio" name="ftp" value="false"><br>
<input type="radio" name="ftp" value="false"><br>
<input type="radio" name="ftp" value="false"><br>
<input type="radio" name="ftp" value="true">
</td>
</tr>
<tr>
<td width=50% colspan=2>
<b>Which of these is not an <u>internet</u> acronym?</b>
</td>
</tr>
<tr>
<td width=25%>
YMCA<br>
HTTP<br>
URL<br>
CGI
</td>
<td width=25%>
<input type="radio" name="acro" value="true"><br>
<input type="radio" name="acro" value="false"><br>
<input type="radio" name="acro" value="false"><br>
<input type="radio" name="acro" value="false">
</td>
</tr>
</table>
<input type="submit" name="submit" value="SUBMIT THE TEST" onClick="ansAdd()">
</form>