Which events fire reliable in IE6 <select>?

Discussion in 'Javascript' started by andreas.maurer1971@web.de, Feb 15, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. Guest

    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, 2006
    #2
    1. Advertising

  3. VK Guest

    wrote:
    > 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.
     
    VK, Feb 15, 2006
    #3
  4. Guest

    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 = 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, 2006
    #4
  5. Guest

    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, 2006
    #5
  6. Donius Guest

    Ha ha ha, that's always the way it is. :) Glad it was solved.
     
    Donius, Feb 16, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ivor O'Connor
    Replies:
    4
    Views:
    875
    Isofarro
    Nov 25, 2003
  2. Peter Mount
    Replies:
    4
    Views:
    975
    Peter Mount
    Jan 31, 2006
  3. Jonathan Wood

    Which System is More Reliable?

    Jonathan Wood, May 4, 2009, in forum: ASP .Net
    Replies:
    9
    Views:
    313
    Jonathan Wood
    May 4, 2009
  4. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    387
    Chris
    Aug 30, 2005
  5. John
    Replies:
    0
    Views:
    98
Loading...

Share This Page