Hi,

I am adding spelling quizzes to my educational site, and I've played with multiple ways to do this. I use Google Docs for most of my quizzes, but I want the spelling tests to be self-checking (I won't see the results, but the user will immediately). I also need to be able to use audio, because I'm using an audio snippet to pronounce each word.

I found some code that works, and I paste it underneath the audio snippet. However, in the example code, it corrects two questions. I adjusted the code to work EXCEPT for the part where it checks the answer--I've messed that up somehow, since it always reports the answer as 0% correct. Could anyone help me find the bug and fix this?

I apologize since this is probably a pretty basic question for most of you, but after a bunch of searching online, I clearly am not using the right terms to find what I need, and I've spent some time comparing the old code to my adjusted code, and I can't figure it out that way, either. Thanks in advance!

I'm removing the first and last <> elements, btw

script type="text/javascript"
function valid() {
cor = "0"
incor = "0"
test0 = document.myform.elements[0].value;
test1 = document.myform.elements[1].value;
if (test0.toLowerCase() == "barriers") {
++cor; }
else ++incor

alert("You are " + cor * 100 + "% correct!");
}
</script>
<body>
<form name="myform"><font face="Arial">
2. What is the correct spelling of this word?
<input type="text" name="q1">
<p>

input type="button" onClick="valid()" value="check answer"