/    Sign up×
Community /Pin to ProfileBookmark

Using onClick with Option Form

Can anyone tell me how I can use onClick rather than a button to process a selection within an Options Form. The process would be to go to a new HTML page with each item pointing to a different page.

In other words:

<form name=”b47″>
<select name=”b111″ size=”3″>
<option value=”http://aaaa.com/file1.html”>file1</option>
<option value=”http://aaaa.com/file2.html”>file2</option>
<option value=”http://aaaa.com/file3.html”>file3</option>
<option value=”http://aaaa.com/file4.html”>file4</option>
…..(etc.)

</select>
</form>

I suspect it can be done, but I’m just too new to know how to code it.

Hope someone can help.

Thanks.
Yizit

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@fredmvDec 19.2003 — You don't want to be listening for an [font=courier]onclick[/font] event &#8212; you want [font=courier]onchange[/font]. For example:&lt;select onchange="if(selectedIndex != 0) location = options[selectedIndex].value;"&gt;
&lt;option&gt;&amp;lt; select an option &amp;gt;&lt;/option&gt;
&lt;option value="http://www.google.com/"&gt;Google&lt;/option&gt;
&lt;option value="http://www.yahoo.com/"&gt;Yahoo&lt;/option&gt;
&lt;option value="http://www.hotbot.com/"&gt;Hotbot&lt;/option&gt;
&lt;/select&gt;
Copy linkTweet thisAlerts:
@YizitauthorDec 19.2003 — Thanks fredmv! Works like a charm!

I bet if I live to be 120, I'll get proficient at this.....


Yizit
Copy linkTweet thisAlerts:
@fredmvDec 20.2003 — You're welcome. If you want an explanation of how it works, please feel free to ask. ?
×

Success!

Help @Yizit 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.7,
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,
)...