Window.location not working

I have the following html page, but the window.location command is not working, while the next line alert(“this is ms office”) works perfectly, why window.location is not moving me to abc.html, if the user enters mso in the text box and clicks submit.

<html>
<head>
<script type=“text/javascript”>

function passcode()
{
course=document.serialenter.course.value;

if (course=="mso")
	{
	window.location = "abc.html";
	alert("this is ms office");
	}
else
	{
	alert("You have entered a wrong serial number");
	}	

}

//–>>
</script>

</HEAD>
<BODY>
<form name=serialenter>
<table width=100% border=0>
<tr width=100% align=center><TD colspan=3>
Please fill in the course code:
<input type=text size=3 maxlength=3 name=course>
<input type=submit value=“Submit” name=submit onclick=passcode()>

					&lt;/td&gt;&lt;/tr&gt;

					&lt;/table&gt;
					&lt;/form&gt;

</body>
</html>

I now tried this, but this is also not working

<script type=‘text/javascript’>

function passcode(f)
{
course=f.course.value;

if (course==“mso”)
{
f.action=‘abcd.htm’;
}
else
{
alert(“You have entered a wrong serial number”);
}
return false;
}

</script>

<form name=serialenter >
<table width=100% border=0>
<tr width=100% align=center><TD colspan=3>
Please fill in the course code:
<input type=text size=3 maxlength=3 name=course>
<input type=submit value=“Submit” onclick=‘return passcode(this.form)’>
</table>
</form>

Now This is working, thanks every body for your help and you may use the below code, if any body else face the same problem, below is working example

<script type=“text/javascript”>

function passcode()
{
course=document.serialenter.course.value;

if (course=="mso")
	{

	window.location = "activation.html";
	//alert("this is ms office");
	

	}
else
	{
	alert("You have entered a wrong serial number");
	}	

}

//–>>
</script>

</HEAD>
<BODY>

				&lt;form name=serialenter onsubmit="return passcode()"&gt;
				&lt;table width=100% border=0&gt;
				&lt;tr width=100% align=center&gt;&lt;TD colspan=3&gt;

					&lt;input type=text size=3 maxlength=3 name=course id=course&gt;
					&lt;input type=button value="Submit" onclick=passcode() &gt;

					&lt;/td&gt;&lt;/tr&gt;

					&lt;/table&gt;
					&lt;/form&gt;

</body>
</html>

I think logic ali is saying correct, but I am not able to correct my code, can you please help correcting my code, particularly i could not understand

onclick=‘return passcode(this.form)’

javascript code mentioned I can understand

Because you’re still submitting the form.

<script type='text/javascript'>

function passcode(f)
{
course=f.course.value;

if (course=="mso")
{
 f.action='abcd.htm';
}
else
{
alert("You have entered a wrong serial number");
}
return false;
}


</script>

<input type=submit value="Submit"  onclick='return passcode(this.form)'>



Try with something like this:

<input type=text size=3 maxlength=3 id=“course”>
<input type=submit value=“Submit” name=submit onclick=passcode()>

js:

function passcode(){
course = document.getElementById(“course”).value;
if (course == “mso”){
window.location = “abc.html”;
alert(“this is ms office”);
}
else
{
alert(“You have entered a wrong serial number”);
}
}

OR

function passcode(){
course = document.getElementById(“course”);
if (course.value == “mso”){
window.location = “abc.html”;
alert(“this is ms office”);
}
else
{
alert(“You have entered a wrong serial number”);
}
}