Click to See Complete Forum and Search --> : Drop-Down menu on Cold fusion site


lexa1999
12-02-2003, 01:13 PM
Hello all-

For a cold-fusion site, how do I edit the below so that a user jumps to the address that he/she selects from the drop down menu. Currently, the URL of the item selected is just appended to the end of the address the user is on.


<script>
<!-- Begin
function formHandler(form){
var URL =
document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End -->
</script>

....and the code:
<form name="form">
<select name="site" size=-1>
<option value="october.cfm">October
<option value="september.cfm">September
<option value="august.cfm">August
<option value="july.cfm">July
</select>
<input type="image" src="../../images/go.gif" onClick="javascript:formHandler(this)">
</form>

requestcode
12-02-2003, 02:30 PM
An input type of "image" is used to submit a form try changing it to an input type of "button" like this:
<input type="button" value="Go There" onClick="formHandler()">

Also change your function to this:
function formHandler(){
var URL =
document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;

You don't need the variable "form" because you are already using the form name in your script.

lexa1999
12-02-2003, 02:40 PM
Thank you for your help. This worked.

Lexa