I have this code where i want to redirect the same page to a new html page but i cant just do it. The code is for form The html page is with me please help
<form class="white-pink" align="center" name="myForms" method="post">
<h1>Search Form
<span>Please Find the car in the fields.</span>
</h1>
<label>
<span>Search Car :</span>
<select name="cars">
<option value="def" disabled="disabled" selected="selected">Please select a name</option>
<option value="honda">Honda</option>
<option value="hyundai">Hyundai</option>
<option value="volkswagon">VolksWagon</option>
<option value="toyota">Toyota</option>
</select>
</label>
<label>
<input type="submit" name="s1" value="Search" class="button" onclick="validateForm();"/>
</label>
</form>
and for the javascript:
<script>
function validateForm()
{ var x=document.forms["myForms"]["cars"].value;
switch (x)
{
case "def":
alert("Please choose a Car Compony");
break;
case "honda":
window.location = "honda.html";
return false;
break;
case 2:
x="Today is Tuesday";
break;
case 3:
x="Today is Wednesday";
break;
case 4:
x="Today is Thursday";
break;
}
}
</script>
there is a drop down list for which after selecting the value i redirect to the required html page