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()>
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”);
}
}