Option onclick does not fire for IE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JehanNYNJ@aol.com

    Option onclick does not fire for IE

    I have found that the onclick does not fire for Option elements in IE.
    Clicking on an option only fires the Select's onclick. Can someone
    please confirm this?

    If it is so then how would we best implement a case where only some of
    the options in a select should trigger the onclick?

    Thanks in advance for any input.

  • McKirahan

    #2
    Re: Option onclick does not fire for IE

    <JehanNYNJ@aol. com> wrote in message
    news:1112883255 .874943.163360@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > I have found that the onclick does not fire for Option elements in IE.
    > Clicking on an option only fires the Select's onclick. Can someone
    > please confirm this?
    >
    > If it is so then how would we best implement a case where only some of
    > the options in a select should trigger the onclick?
    >
    > Thanks in advance for any input.
    >[/color]


    Test in the select's onclick:

    <html>
    <head>
    <title>optClick .htm</title>
    <script type="text/javascript">
    function clicker(that) {
    var pick = that.options[that.selectedIn dex].value;
    if (pick == "2") alert("Hello World");
    }
    </script>
    </head>
    <body>
    <form>
    <select name="sel" onclick="clicke r(this)">
    <option value="1">One
    <option value="2">Two
    <option value="3">Three
    </select>
    </form>
    </body>
    </html>


    Comment

    • RobB

      #3
      Re: Option onclick does not fire for IE


      JehanNYNJ@aol.c om wrote:[color=blue]
      > I have found that the onclick does not fire for Option elements in[/color]
      IE.[color=blue]
      > Clicking on an option only fires the Select's onclick. Can someone
      > please confirm this?
      >
      > If it is so then how would we best implement a case where only some[/color]
      of[color=blue]
      > the options in a select should trigger the onclick?
      >
      > Thanks in advance for any input.[/color]

      Option objects in MSIE have zero event handlers. Processing of
      listboxes is generally done via the Select.onchange handler, and the
      Select.selected Index property (which holds the index of the currently
      selected option). Presumably you can accomplish whatever you need to
      using this approach.

      Comment

      Working...