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

Which events fire reliable in IE6 <select>?

Hi everybody,

I nearly get despaired of the fact that the events I chose and,
according to the MSDN site, are correct, don't fire reliable in IE6.
Is someone able to tell me, which events I can use for the following
situation?

I have a <select> list with dynamically generated options. Latest when
I have changed the (pre-) selected option and loose the focus of the
select-list I want to run a function to find out about the newly
selected option and act accordingly.

I tried the events onblur = somefunction(), onfocus = somefunction(),
onselect = somefunction() and even onselectstart = somefunction() and
used them like follows:

<SELECT ID="IDNAME" SIZE="1" ONFOCUS="somefunction()"
ONBLUR="somefunction()"></SELECT> in nearly every combination, e.g.
only onfocus or combined as above and with and without the "" around
somefunction().

Unfortunately with neither event somefunction() gets called.

Please note that the solution only has to work in IE6 and not in other
browsers.

Thank you very much in advance,

Andy

Feb 15 '06 #1
5 1522

andreas.maurer1...@web.de schrieb:
Hi everybody,

[EDIT]

I forgot to mention that this <select> box is within a frameset.
Just in case that this matters.

Andy

Feb 15 '06 #2
VK

andreas.maurer1...@web.de wrote:
andreas.maurer1...@web.de schrieb:
Hi everybody,

[EDIT]

I forgot to mention that this <select> box is within a frameset.
Just in case that this matters.


Where do you process the events? In the frame with <select> list or in
some other frame? If in some other frame and these are frames from
different domains then you cannot capture events with default security
settings.

Just to check that your system works:

<select name="foo" onchange="alert(this.selectedIndex)">
<option selected>1</option>
<option>2</option>
<option>3</option>
</select>

Copy'n'paste as it is into your form and select something. See if alert
pops up.

Feb 15 '06 #3

VK schrieb:
Just to check that your system works:

<select name="foo" onchange="alert(this.selectedIndex)">
<option selected>1</option>
<option>2</option>
<option>3</option>
</select>

Copy'n'paste as it is into your form and select something. See if alert
pops up.


Hi VK,

thank you for your answer.
I have copied your code into my HTML- file and it works.
Doing the same (simply changeing the function call to the alert(...))
within my <select> list doesn't work.

Could it be that it has something to do with my dynamical creation of
the <option>- tags?

this.IDNAME[0] = new Option("some text", 0 , true, false); // default
selected
this.IDNAME[1] = new Option("some other text", 0 , false, false);
for (var i = 2; i < 10 ; i++) {
this.IDNAME[i] = new Option("some more text", i, false, false); //
some more text is just an example and displays well ;-)
}

I process the event in the same html-file and therefore the same frame.
The function origially was located at the end of the file but now I
have moved it to the <head> part of it. Thank's for asking where I
process it. This might have been another, more difficult to find
mistake.

Andy

Feb 15 '06 #4

an****************@web.de schrieb:
VK schrieb:


Hi VK and everyone,

the problem is solved.

The reason for it was that I had a second <select> - tag with the same
id just a few lines above the "real" tag due to some copy/paste.
Of course IE got confused and didn't know where it was.

Sorry for wasting your time but trust me, if a colleague wouldn't have
looked over my shoulders and asked me what the second tag is good for I
never would have found it although I already spent literally hours on
this problem.

Andy

Feb 15 '06 #5
Ha ha ha, that's always the way it is. :) Glad it was solved.

Feb 16 '06 #6

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

Similar topics

1
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...
6
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets...
5
by: Brian Foley | last post by:
Hello, I am used to using the label tag with check boxes and radio buttons in html forms. This allows me to click on the text of the label to activate/deactivate the check box / button, rather...
6
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...
6
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...
1
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)"...
4
by: Man-wai Chang | last post by:
-- iTech Consulting Co., Ltd. Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
14
mikek12004
by: mikek12004 | last post by:
In a form I have 5 elements (e.g. pictures) and I wish for the user to be able to set the order of appearance. For this I have for each picture a select box (names select1 to select5) with "please...
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:
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?
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
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
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.