By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,345 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

onclick OK IE not Firefox?

P: n/a
Hello

the following onclick works with IE 7 but not with Firefox 2.0.0.9.

any ideas please?

<form action="">
<select name="txtId">
<option="word1">word1</optionetc
</select>

<p><input type="button" value="Get def"
onclick="requestInfo(this.form.txtId.options[this.form.txtId.selectedIndex].value);"></p>

</form>

Cheers

Geoff
Nov 18 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Sun, 18 Nov 2007 14:42:02 -0500, "Jonathan N. Little"
<lw*****@centralva.netwrote:
>Geoff Cox < wrote:
>Hello

the following onclick works with IE 7 but not with Firefox 2.0.0.9.
>The problem is most likely in your JavaScript function requestInfo which
you have not suppled. But passing the value does, see for yourself.
Jonathan,

thanks for your script - it at least showed me that onclick can work
with Firefox!

In fact the mistake was having

<form action"">
<select name="txtId">

changing to id="txtId",

<form action="">
<select id="txtId">

and all is well!

Cheers

Geoff
Nov 18 '07 #2

P: n/a
On Nov 19, 6:45 am, Geoff Cox <<>wrote:
On Sun, 18 Nov 2007 14:42:02 -0500, "Jonathan N. Little"

<lws4...@centralva.netwrote:
Geoff Cox < wrote:
Hello
the following onclick works with IE 7 but not with Firefox 2.0.0.9.
The problem is most likely in your JavaScript function requestInfo which
you have not suppled. But passing the value does, see for yourself.

Jonathan,

thanks for your script - it at least showed me that onclick can work
with Firefox!

In fact the mistake was having

<form action"">
<select name="txtId">

changing to id="txtId",
Using a name attribute was not what stopped the script for working, it
works with a name attribute (probaby more reliably than with an ID).
Chaning it to an ID attribute probably is a mistake - a control
without a name can't be sucessful and will not be included in the data
send when the form is submitted.

If you want the form to submit normally, you must add a name. If you
make the form's submission script-dependent, you are making your pages
less accessible for no good reason. You do not need an ID for the
control to be accessible by script, so just use a name.
>
<form action="">
<select id="txtId">

and all is well!
I don't think so.
--
Rob
Nov 19 '07 #3

P: n/a
Geoff Cox < said the following on 11/20/2007 3:09 AM:
On Mon, 19 Nov 2007 19:37:24 -0500, Randy Webb
<Hi************@aol.comwrote:

Randy,

If you have the patience could you briefly outline how this new code
works!
<snip>
function getKw(param1) {
param1 is nothing but a parameter to the function.
http.open("GET", url + escape(param1), true);
It uses param1 in the above line.
<input type="button" value="Get definition"
onclick="getKw(this.form.kwSelection.value)">
this.form.kwSelection.value refers to the value of the select list and
is passed to the function.

Anything you were curious about that I didn't explain?
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 20 '07 #4

P: n/a
On Tue, 20 Nov 2007 04:17:19 -0500, Randy Webb
<Hi************@aol.comwrote:
>Geoff Cox < said the following on 11/20/2007 3:09 AM:
>On Mon, 19 Nov 2007 19:37:24 -0500, Randy Webb
<Hi************@aol.comwrote:

Randy,

If you have the patience could you briefly outline how this new code
works!

<snip>
>function getKw(param1) {

param1 is nothing but a parameter to the function.
> http.open("GET", url + escape(param1), true);

It uses param1 in the above line.
><input type="button" value="Get definition"
onclick="getKw(this.form.kwSelection.value)">

this.form.kwSelection.value refers to the value of the select list and
is passed to the function.

Anything you were curious about that I didn't explain?
Randy,

No - that's fine, thanks.

Cheers

Geoff
Nov 20 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.