Simple conditional statement HELP needed

Hello,
I am not a javascripter however I have a simple need to a yes no question before someone can fill out a form. Bloew is what I have. If they click yes I’ll take them to the form, if no then I will redirect them to a different page. I can not get it to work. Any help would be appreciated.


<script type="text/javascript">
<!--
function valbutton(thisform) {

if(thisform.myradiobutton.checked==true){

                var radiovalue = thisform.myradiobutton.value;

                if(radiovalue == "yes"){

                window.location = "http://www.google.com/";

                } else {

                window.location = "http://www.gmail.com/";
                }
}
   return false;
}
//-->
</script>
<form name="myform" method="POST">

<input type="radio" value="yes" name="myradiobutton" />yes<br />

<input type="radio" value="no" name="myradiobutton" />no<br />

<input type="submit" name="submitit" onclick="valbutton(myform);" value="Validate" />
</form>

Thanks
Tim

thisform.myradiobutton is an array

If they click yes I’ll take them to the form, if no then I will redirect them to a different page.

Question: why is this set up like this?

Could this just be two anchors, disguised as buttons? If they click one, they go to url=thepagewiththeform.html
if they click the other, they go to url=someotherpage

Radio-button-ness is preserved if they get shifted somewhere else either way, because you can’t click two links simultaneously anyway.

Or is there really MORE to this form than you showed (are they filling in other things, then hitting a radio button and their old data is supposed to go with them??)?