473,799 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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="fillFi elds()"

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="selectFil terFields" onselect="fillF ields()"
style="font-family: monospace;">

And the new code is:

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

but neither version works. Am I doing something wrong?

Thanks!

Hal

Jul 20 '05 #1
6 16834
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="fillFi elds()"

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="selectFil terFields" onselect="fillF ields()"
style="font-family: monospace;">

And the new code is:

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

but neither version works. Am I doing something wrong?

Thanks!

Hal


Jul 20 '05 #2
Ivo
onfocus
Jul 20 '05 #3
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
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
On Tue, 17 Feb 2004 06:35:55 GMT, Hal Vaughan <ha*@thresholdd igital.com>
wrote:

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

onclick="fillFi elds()"

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.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #6
Hal Vaughan <ha*@thresholdd igital.com> wrote in
news:fDiYb.4834 6$uV3.100005@at tbi_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="fillFi elds()"

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3825
by: Andrea | last post by:
Hi, I'm trying to emulate part of our client-server application as a web site so customers can use it, and I'm stuck when it comes to re-ordering items in a list. Basically we have a list of available articles ("availableItems") and a list of articles already in an issue ("selectedItems"). What I want is to be able to move articles freely between the two lists and then on submission add them to the issue (which I can), but also move...
1
2419
by: Ang Talunin | last post by:
Hey, I wondering if it's possible to retrieve all the <option>-fields from a <select> when posting a <form> to a php file Example: I've got a form like this: <form action = phpfile.php method=post > <select name= "name">
2
7123
by: LC's No-Spam Newsreading account | last post by:
I have a form arranged in a table (you can see an example in the page http://cosmos.mi.iasf.cnr.it/~lssadmin/Website/LSS/Help/query.html) The table is on three columns but has a structure like this. The part I'm concerned with is the cell FFFFF which contains a multiple <SELECT> list of <OPTION>s. As you can see the first two rows span more than one column (if this has any importance). What I want is to constrain FFFFF not to exceed a...
2
1953
by: Craig Keightley | last post by:
How do I retrive the Name of the item in a select box I have the following form <select name="select"> <option value="1">Monday</option> <option value="2">Tuesday</option> <option value="3">Wednesday</option> <option value="4">Thursday</option> </select>
2
9966
by: @sh | last post by:
Hi guys, As far as I understand it, there is no possible way to add an OnSelect/Onchange to an actual <option> within a select tag (to perhaps jump to a page or run a DOM command), is this still correct with modern client browser advances (obviously taking into account the incompatibilities of this method with older browsers). Cheers, Ash
6
13026
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this is not an ASP.NET related question, but I know this group is knowledgeable and quick with responses. Thanks
6
19615
by: joseph.lindley | last post by:
Forgive me for I am a bit of a web-dev novice - but I'm not doing too bad. I'm currently working with a bit of javascript to dynamically add <option>s into a select box. My code currently works fine in Internet Explorer, however in Firefox the dropdown only displays the first option in the list, and when clicked the other values aren't displayed. Here is the code;
1
1871
by: frey | last post by:
i tried to create a dropdown menu and use the option as a control to change content inside another text area the code is like this: <select name="xxxx"><option onclick="changeunitprice(29.87)" value="1744"/> the function changeunitprice() is called when an option is selected
14
9267
by: The Natural Philosopher | last post by:
This is a nasty one and I can't see my way out of it. I have a bunch of select statements in a form, and each select statement has an onchange="do_something(this)" in it, and this works nicely..except when there is only ONE OPTION in a given select. It seems you cannot 'onchange' a single option! Well, that is reasonable. The trouble is I have no way of selecting it since the form itself is a
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10475
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.