Code:
<INPUT class=btn type=submit
onClick="valid(this.option1,this.option2,this.option3,this.option4);
P7_Snap('option1','correctDiv',20,5)" value=Submit name=submit>
This is wrong... The
this here refers to the submit button.
You would need to use
Code:
<INPUT class=btn type=submit
onClick="valid(this.form.option1,this.form.option2,this.form.option3,this.form.option4);
P7_Snap('option1','correctDiv',20,5)" value=Submit name=submit>
But it's kind of pointless, as when the user clicks on this submit button the form will be submitted and then you will end up calling the
valid( ) function *again* in the <form onsubmit="valid(...)">. So why bother?
But then making the call from the <form onsubmit> is kind of pointless, too.
Code:
<form onsubmit="return valid(this.option1,this.option2,this.option3,this.option4)"
target="_self" name="a01" id="a01" method="post"
action="/toolbox/wkbAssessAct.asp" class="Form1">
Because your
valid( ) function never returns any value, the
return in that onsubmit is useless, and the form will *ALWAYS* be submitted. Meaning that any change is the display of the various <div>s will only last at most a second while the new page (wkbAssessAct.asp) is fetched from the server.
If you want your show and hide div stuff to actually *work* and for the user to stay on the same page after it works, you need to
return false from the
valid( ) function else the page *will* submit.
I would also like to point out that if this is supposed to be a quiz then it is kind of useless, as the user can see the answer by simply doing a VIEW-->>SOURCE on the web page.