Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Which events fire reliable in IE6 <select>?

Reply
Thread Tools

Which events fire reliable in IE6 <select>?

 
 
andreas.maurer1971@web.de
Guest
Posts: n/a
 
      02-15-2006
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

 
Reply With Quote
 
 
 
 
andreas.maurer1971@web.de
Guest
Posts: n/a
 
      02-15-2006

(E-Mail Removed) schrieb:

> Hi everybody,

[EDIT]

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

Andy

 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      02-15-2006

(E-Mail Removed) wrote:
> (E-Mail Removed) 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.

 
Reply With Quote
 
andreas.maurer1971@web.de
Guest
Posts: n/a
 
      02-15-2006

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

 
Reply With Quote
 
andreas.maurer1971@web.de
Guest
Posts: n/a
 
      02-15-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) 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

 
Reply With Quote
 
Donius
Guest
Posts: n/a
 
      02-16-2006
Ha ha ha, that's always the way it is. Glad it was solved.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which Free upload site to use....which is Fast & Reliable divyaf@gmail.com Digital Photography 1 07-26-2007 09:34 PM
Fire with fire Little Green Eyed Dragon Digital Photography 0 08-16-2006 12:15 AM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
On fighting fire with fire... skip@pobox.com Python 16 08-01-2005 07:09 PM



Advertisments