I have written the following function which is executed from the submit button on click event.
When I operate it I get the message box, but the browser doesn't redirect. Can anyone help!
Code: Select all
<script type="text/javascript">
<!--
function testbutton()
{
var searchForm = document.search;
var linkAddress;
if (searchForm.region.value == "ALL" && searchForm.specialism.value == "ALL" )
{
linkAddress = searchForm.region.value + searchForm.specialism.value + ".html";
alert("both regions set to all " + linkAddress + "!");
window.location.href = linkAddress;
}
else if (searchForm.region.value == "ALL" && searchForm.specialism.value != "ALL" )
{
linkAddress = searchForm.specialism.value + ".html";
alert("only specialism selected! " + linkAddress);
window.location.href = linkAddress;
}
else if (searchForm.region.value != "ALL" && searchForm.specialism.value == "ALL" )
{
linkAddress = searchForm.region.value + ".html";
alert("only region selected! " + linkAddress);
window.location.href = linkAddress;
}
else
{
linkAddress = searchForm.specialism.value + "-" + searchForm.region.value + ".html";
alert("both selected! " + linkAddress);
window.location.href = linkAddress;
}
}
// -->
</script>feyd |