Click to See Complete Forum and Search --> : dropdown list links not working


charlie
08-26-2003, 12:19 PM
hey guys,
i had this dropdown list that uses javscript to go to the url when clicked, it did work but i went through removing whitespace from my files and maybe i removed something from the code but it doesnt work now, could someone have a look, it's not live so here's a bit of code:

<script type="text/javascript">
function go()
{
location=document.forms[0].gowhere.value
}
</script>



<select id="gowhere" onchange="go()">
<option>-Select location-
<option value="alfaz.html">Alfaz del Pi
<option value="alicante.html">Alicante
<option value="altea.html">Altea
<option value="benidorm.html">Benidorm

pyro
08-26-2003, 12:37 PM
Try:

<script type="text/javascript">
function go() {
window.location.href = document.forms[0].gowhere.options[document.forms[0].gowhere.selectedIndex].value;
}
</script>

AdamBrill
08-26-2003, 12:42 PM
Or just use this:<select id="gowhere" onchange="if(this.value!=undefined)document.location=this.value;">
<option>-Select location-</option>
<option value="alfaz.html">Alfaz del Pi</option>
<option value="alicante.html">Alicante</option>
<option value="altea.html">Altea</option>
<option value="benidorm.html">Benidorm</option>
</select>