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

<OPTION> No Longer Responds to onClick() or onSelect()

P: n/a
I'm using KDE on Linux, with Konqueror as the testing browser for this
project. I've recently upgraded, so I realize some of the bugs I'm dealing
with may or may not be my program, and could also result from me being less
than perfect in my preliminary coding on test pages.

I had an <OPTION> element, 10 lines in size. Previously I used:

onclick="fillFields()"

and when I clicked on a line in the <OPTION> element, the data was
transferred into an input box below. Now when I try the same thing,
nothing happens. I even replaced the original with:

onclick="alert('got click')"

and there was no response. I replaced "onclick" with "onselect", but it
made no difference.

Does this sound like a programming problem, events <OPTION> elements aren't
supposed to respond to, or a bug in the newer version of the browser?

The original HTML code is:

<select size="10" name="selectFilterFields" onselect="fillFields()"
style="font-family: monospace;">

And the new code is:

<select size="10" name="selectFilterFields" style="font-family: monospace;"
onclick="alert('Selected!')">

but neither version works. Am I doing something wrong?

Thanks!

Hal

Jul 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
I didn't realize I used <OPTION> instead of <SELECT> in the title and post.
s/<OPTION>/<SELECT>/g.

Oops...

Hal Vaughan wrote:
I'm using KDE on Linux, with Konqueror as the testing browser for this
project. I've recently upgraded, so I realize some of the bugs I'm
dealing with may or may not be my program, and could also result from me
being less than perfect in my preliminary coding on test pages.

I had an <OPTION> element, 10 lines in size. Previously I used:

onclick="fillFields()"

and when I clicked on a line in the <OPTION> element, the data was
transferred into an input box below. Now when I try the same thing,
nothing happens. I even replaced the original with:

onclick="alert('got click')"

and there was no response. I replaced "onclick" with "onselect", but it
made no difference.

Does this sound like a programming problem, events <OPTION> elements
aren't supposed to respond to, or a bug in the newer version of the
browser?

The original HTML code is:

<select size="10" name="selectFilterFields" onselect="fillFields()"
style="font-family: monospace;">

And the new code is:

<select size="10" name="selectFilterFields" style="font-family:
monospace;" onclick="alert('Selected!')">

but neither version works. Am I doing something wrong?

Thanks!

Hal


Jul 20 '05 #2

P: n/a
Ivo
onfocus
Jul 20 '05 #3

P: n/a
Ivo wrote:
onfocus


Thanks, but it doesn't work either (I just tried it). Absolutely NO
response with onfocus.

Is this more likely a browser issue than my programming? (Shouldn't
onclick, onselect, and onfocus all work in this case?)

Hal
Jul 20 '05 #4

P: n/a
Hal Vaughan wrote:
Ivo wrote:
onfocus


Thanks, but it doesn't work either (I just tried it). Absolutely NO
response with onfocus.


onchange?

--
If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are
Groucho, Chico, and Harpo, then Usenet is Zeppo.
Jul 20 '05 #5

P: n/a
On Tue, 17 Feb 2004 06:35:55 GMT, Hal Vaughan <ha*@thresholddigital.com>
wrote:

[snip]
I had an <OPTION> [edit: SELECT] element, 10 lines in size.
Previously I used:

onclick="fillFields()"

and when I clicked on a line in the <OPTION> [edit: SELECT] element,
the data was transferred into an input box below. Now when I try
the same thing, nothing happens. I even replaced the original with:

onclick="alert('got click')"

and there was no response. I replaced "onclick" with "onselect", but
it made no difference.


The onselect event is used when text is selected in an INPUT or TEXTAREA
element, not when you select from a SELECT element.

I just posted a solution to someone else's problem ("Calculated fields")
which uses the onchange event on SELECT elements to update an INPUT, and
it works in Opera, Mozilla, Netscape and IE (all WinXP). If onchange
doesn't work for you, in similar usage, Konqueror is broken. However, if

<select ... onclick="alert('a')">

doesn't display 'a' on-click, it is equally broken.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #6

P: n/a
Hal Vaughan <ha*@thresholddigital.com> wrote in
news:fDiYb.48346$uV3.100005@attbi_s51:
I'm using KDE on Linux, with Konqueror as the testing browser for this
project. I've recently upgraded, so I realize some of the bugs I'm
dealing with may or may not be my program, and could also result from
me being less than perfect in my preliminary coding on test pages.

I had an <OPTION> element, 10 lines in size. Previously I used:

onclick="fillFields()"

and when I clicked on a line in the <OPTION> element, the data was
transferred into an input box below. Now when I try the same thing,
nothing happens. I even replaced the original with:

onclick="alert('got click')"

and there was no response. I replaced "onclick" with "onselect", but
it made no difference.


Have you run your HTML through a validator? If not, do so and fix any
errors that it points up. It's often the case that new versions of
browsers change the way they deal with invalid HTML, often causing
something that "worked" in a previous version to fail in the new version.
Plainly what's going on is that Konqueror isn't paying any attention to
your action attributes (since your "alert" example is plainly correct
Javascript); the reason may be that its parser is getting out of sync due
to some invalid HTML. Come to think of it, make sure you haven't
inadvertently disabled Javascript in the browser as well.
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.