473,385 Members | 1,720 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,385 software developers and data experts.

Changing selectedIndex and onchange events

Whilst I have no immediate need for it, I've noticed that if a select
element is changed via setting the selectedIndex value, it does not
fire an onchange event. Is there any reason for this? Both IE 6 and FF
2 behave the same in regards to this.

Is it the developers responsibility to fire this event in such a
situation?

Mar 20 '07 #1
2 9468
VK
On Mar 20, 7:55 pm, "Tom Cole" <tco...@gmail.comwrote:
Whilst I have no immediate need for it, I've noticed that if a select
element is changed via setting the selectedIndex value, it does not
fire an onchange event. Is there any reason for this?
At least for IE there is:
http://msdn.microsoft.com/workshop/a...s/onchange.asp
"The onchange event does not fire when the selected option of the
select object is changed programatically."

I don't remember if it is some standard DOM interface feature or a
"default common behavior" of all browsers. From the practical point of
view it is not so relevant though.
Both IE 6 and FF 2 behave the same in regards to this.
Yes, see above.
Is it the developers responsibility to fire this event in such a
situation?
I'm afraid so. And remember that custom events do not propagate
(bubble) so you have to fire them for each event consumer separately.

Mar 20 '07 #2
On Mar 21, 2:55 am, "Tom Cole" <tco...@gmail.comwrote:
Whilst I have no immediate need for it, I've noticed that if a select
element is changed via setting the selectedIndex value, it does not
fire an onchange event. Is there any reason for this? Both IE 6 and FF
2 behave the same in regards to this.

Is it the developers responsibility to fire this event in such a
situation?
The W3C event model provides dispatchEvent, IE provides fireEvent.
The archives are a remarkable resource - Michael Winter provides a
very comprehensive answer here:

subject: How to trigger event programmatically?
<URL:
http://groups.google.com.au/group/co...cea9cdf065a524
>

--
Rob

Mar 21 '07 #3

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

Similar topics

1
by: Young-Soo Roh | last post by:
Hi. I need to get simple script working. I have many select object. When I select a different option, I would like to change the value of corresponding text input field. How can I do this using...
1
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with...
1
by: WebRaster | last post by:
I wish to know if is possible to change the selected option in a SELECT selecting a determined option into another SELECT in the same form. E.g: When I select the option "Istruction" in the...
4
by: KK | last post by:
Hi All... For my purpose, I need to handle listbox selection changed event.I must be notified before changing occurs and after.After I can handle using SelectedIndexChanged event.Is there anyway...
2
by: Monty | last post by:
I use a SELECT dropdown as the nav interface for jumping to a chosen page number. When I setup up the SELECT element on the page, I want to show the user the current page number they are on, so, I...
4
by: Robert Bravery | last post by:
HI all, In JS, how can I change the selected value of a dropdownlist(select options) I know the value of indexed value of the selected value before it is changed. Thanks Robert
4
by: Jessica | last post by:
Page: http://www.doublooncove.com/signup.php Problem: In Firefox, the changes work fine. In IE, the images just disappear, and there is a broken image. The images are THERE. Some are blank...
3
by: vivela | last post by:
hi, I hope you could help me out on this one,cause I have been trying for 4 days to solve it,but couldn't quite get it right: I have an ASP textbox that should change the value in a dropdownlist....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.