Redirect not working

wxdqz

New Member
Something is going wrong here, but I cannot find the exact error :-(
I have a form with pull-down menus, which looks like this:

<FORM onSubmit="return check();" NAME="MyForm" METHOD="POST">
<SELECT NAME="a">
<OPTION VALUE=http://www.webdeveloper.com/forum/archive/index.php/"#">Maak uw keuze
<OPTION VALUE="#">-----------------------
<OPTION VALUE="20">20
<OPTION VALUE="50">50
<OPTION VALUE="75">75
<OPTION VALUE="#">-----------------------
</SELECT>

<SELECT NAME="b">
<OPTION VALUE="#">Maak uw keuze
<OPTION VALUE="#">-----------------------
<OPTION VALUE="rijen">rijen
<OPTION VALUE="tafels">tafels
<OPTION VALUE="#">-----------------------
</SELECT>

<INPUT TYPE="image" SRC="images/start.gif" WIDTH="42" HEIGHT="16" ALT="Start" BORDER="0">

</FORM>

Then in the HEAD of this same page, I have a JavaScript that looks like this:
<script language="JavaScript">
function check()
{
var a = document.MyForm.a.value;
var b = document.MyForm.b.value;

if(a=="20" && b=="rijen")
{
// document.location.href ='c.html';
window.location='c.html';
}

}
</script>

As you can see, I would like to redirect to another page here, depending on which options are chosen. But the redirect does not work. If I use an alert in the if-statement, it works fine, but the redirect doesn't. What am I doing wrong??? Is it something in the form itself, or something in the JavaScript?
This is driving me crazy.
 
Back
Top