/    Sign up×
Community /Pin to ProfileBookmark

Drop-Down menu on Cold fusion site

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>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@requestcodeDec 02.2003 — 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.
Copy linkTweet thisAlerts:
@lexa1999authorDec 02.2003 — Thank you for your help. This worked.

Lexa
×

Success!

Help @lexa1999 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...