...

View Full Version : javascript onchange method



guitarlass
08-23-2010, 04:17 AM
Hello,
i wrote this code, But is not working, i want to use onChange event and redirect user into a url accordingly. this is my code;

<script type="text/javascript">

function goto()
{
var URL = document.frmsort.optsort.options[document.optsort.optsort.selectedIndex].value;
window.location.href = URL;
}

</script>

<form id="frmsort" name="frmsort" action="http://localhost/APP/category.php" method="post">
<select name="urls" onChange="goto()">
<option value="http://localhost/APP/category.php?sub=1">-- choose option --</option>
<option value="http://localhost/APP/category.php?sub=1&sort=1">OP1</option>
<option value="http://localhost/APP/category.php?sub=1&sort=2">OP2</option>
</select> </form>


I really appreciate your help...
thank you...

Philip M
08-23-2010, 06:46 AM
var URL = document.frmsort.urls.value;
window.location.href = URL;


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum