473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Option onclick does not fire for IE

I have found that the onclick does not fire for Option elements in IE.
Clicking on an option only fires the Select's onclick. Can someone
please confirm this?

If it is so then how would we best implement a case where only some of
the options in a select should trigger the onclick?

Thanks in advance for any input.

Jul 23 '05 #1
2 11741
<Je*******@aol.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have found that the onclick does not fire for Option elements in IE.
Clicking on an option only fires the Select's onclick. Can someone
please confirm this?

If it is so then how would we best implement a case where only some of
the options in a select should trigger the onclick?

Thanks in advance for any input.

Test in the select's onclick:

<html>
<head>
<title>optClick.htm</title>
<script type="text/javascript">
function clicker(that) {
var pick = that.options[that.selectedIndex].value;
if (pick == "2") alert("Hello World");
}
</script>
</head>
<body>
<form>
<select name="sel" onclick="clicker(this)">
<option value="1">One
<option value="2">Two
<option value="3">Three
</select>
</form>
</body>
</html>
Jul 23 '05 #2

Je*******@aol.com wrote:
I have found that the onclick does not fire for Option elements in IE. Clicking on an option only fires the Select's onclick. Can someone
please confirm this?

If it is so then how would we best implement a case where only some of the options in a select should trigger the onclick?

Thanks in advance for any input.


Option objects in MSIE have zero event handlers. Processing of
listboxes is generally done via the Select.onchange handler, and the
Select.selectedIndex property (which holds the index of the currently
selected option). Presumably you can accomplish whatever you need to
using this approach.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick...
5
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below...
7
by: Ryan Ternier | last post by:
I have a check box on my page. When a user clicks this box I have a confirmation box come up. When the user clicks OK, true is returned, otherwise false. Now, when true is Returened, I want...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
1
by: puneet.bansal | last post by:
Hi, I want to know the index of the option that a user clicks on in a multiple-select object (regardless of whether he selected or deselected it). This seems fairly simple but I can't seem to...
3
by: James Black | last post by:
I have a select box that uses onclick on each option tag. This works fine in firefox, but not in IE or Safari. I don't know if I should use onblur for each option. I don't want to use...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
7
by: prash.marne | last post by:
Hello, I have a simple form <form method="POST"> <select name="activity"> <option value="0">None</option> <option value="M" onclick="popup_onclick()">Select Multiple</option> <option...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.