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

FireFox: event handling problem

Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.

Thanks
Jan 17 '08 #1
4 3894
On Jan 17, 7:49*am, StepanM <stepmikhay...@yandex.ruwrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.
It is very important to realize that displaying an alert after a
change or blur event makes for an annoying and error-prone interface
(so don't do it.) Use the containing form's submit event for
validation.
Jan 17 '08 #2
StepanM wrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.
I have noted that..the onchange() doesn't trigger until you change
focus to another bit of the screen in some browsers in some situations.

I think I fixed it once by using onmouseout() and then checking which
option was selected, and if it wasn't already selected, triggering the
script I wanted.
Thanks
Jan 17 '08 #3
On Jan 17, 11:48*am, The Natural Philosopher <a...@b.cwrote:
StepanM wrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.

I have noted that..the onchange() *doesn't trigger until you change
focus to another bit of the screen in some browsers in some situations.

I think I fixed it once by using onmouseout() and then checking which
option was selected, and if it wasn't already selected, triggering the
script I wanted.
That would assume that a pointing device is in use. In any event, I
wouldn't recommend such an approach.
Jan 17 '08 #4
On Jan 17, 10:49*pm, StepanM <stepmikhay...@yandex.ruwrote:
Problem with event handling in FireFox. I have two controls on HTML
page: ListBox and TextBox (<selectand <input>). Both controls have
event "onchange" and functions for this event (e.g. select_onchange
and text_onchage). If I select item in ListBox, than I enter text in
TextBox, and than I finally select other item in ListBox, then both
events fires simultaneously (it can be checked up, if in both
functions write a corresponding "alert", both alerts appear
simultaneously). How to solve this problem?
It is very important.
Onchange can be difficult to program - it is supposed to fire when an
element loses focus, but some browsers don't wait for that for some
form controls while others do.

I expect what is happening in your case is that when you click on the
select the second time, that is when the text area loses focus and
fires its onchange event. Displaying the alert probably causes the
select to lose focus with perhaps a different option selected so it
too fires its onchange event.

You need to investigate using a different event for one or perhaps
both controls. Without knowing what you are actually trying to do, a
more precise solution can't be suggested.

Do you have a small example you can post, along with a description of
what you want to happen?
--
Rob
Jan 18 '08 #5

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

Similar topics

4
by: Eric | last post by:
How can I dynamically assign an event to an element? I have tried : (myelement is a text input) document.getElementById('myelement').onKeyUp = "myfnc(param1,param2,param3)"; ...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
9
by: Ja NE | last post by:
(I'm not a programer, I have learned enough php to build my cms, but that doesn't make me coding guru, so please excuse me if I'm asking something trivail...) well, I have one upload form where...
7
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script...
2
by: Serena | last post by:
I have a problem whit this script. It is compatible with IE but isn't with Firefox. The error are: 1) "e has no properties" at----- "if(e.pageX || e.pageY) {" 2) "document.getElementById()"...
2
by: yb | last post by:
I am attempting to modify the style of an element (its width) as the window is being resized, in firefox. Long story short, I've tried to use CSS but one particular part of the layout just won't...
1
by: jayturley | last post by:
I have a web page with the following items on it: <label for="commissionschedule"> Commission Schedule<br /> <span id="charCounter">1000 characters or less</span> </label> <textarea...
1
by: ehud37new | last post by:
this script work fine in IE but not in FireFox where is the problem? here is the script /*------------------------------------------------------------------ File: menu.js ...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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.