471,599 Members | 927 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

how pass option values to JS routine?

Hello,

The code below is an attempt to get an option value, word1 or word2,
into the requestInfo() javascript routine - but it isn't working -
why?!
<p>Select keyword:</p>
<p><input type="hidden" id="txtdef" value="" /></p>

<select name="txtdef">
<option value="word1">word1</option>
<option value="word2">word2</optionetc
</select>

<p><input type="button" value="Get definition" onclick="requestInfo()"
/></p>

<div class="divdefInfo"></div>

I am no doubt missing something obvious!?

Cheers

Geoff
Nov 18 '07 #1
2 2266
VK
On Nov 18, 6:16 pm, Geoff Cox <<>wrote:
<p>Select keyword:</p>
<p><input type="hidden" id="txtdef" value="" /></p>

<select name="txtdef">
<option value="word1">word1</option>
<option value="word2">word2</optionetc
</select>

<p><input type="button" value="Get definition" onclick="requestInfo()"
/></p>
IMO comp.lang.javascript is much more convenient place to ask such
questions; Followup set to comp.lang.javascript is you need more help

onclick="requestInfo()"
OK, but who will report the current selection to the function? ;-)

onclick="
requestInfo(
this.form.txtdef[this.form.txtdef.selectedIndex].value);"
Nov 18 '07 #2
On Sun, 18 Nov 2007 07:59:37 -0800 (PST), VK <sc**********@yahoo.com>
wrote:
>On Nov 18, 6:16 pm, Geoff Cox <<>wrote:
><p>Select keyword:</p>
<p><input type="hidden" id="txtdef" value="" /></p>

<select name="txtdef">
<option value="word1">word1</option>
<option value="word2">word2</optionetc
</select>

<p><input type="button" value="Get definition" onclick="requestInfo()"
/></p>

IMO comp.lang.javascript is much more convenient place to ask such
questions; Followup set to comp.lang.javascript is you need more help

onclick="requestInfo()"
OK, but who will report the current selection to the function? ;-)

onclick="
requestInfo(
this.form.txtdef[this.form.txtdef.selectedIndex].value);"
thanks - working OK in IE but not Firefox! an onclick problem? have
posted in the javascript ng.

Cheers

Geoff
Nov 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Martin McCormick | last post: by
7 posts views Thread by ritchie | last post: by
13 posts views Thread by Shannon Richards | last post: by
19 posts views Thread by nazgulero | last post: by
reply views Thread by rn5a | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.