safari select option onmouseover event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • linuskamb
    New Member
    • May 2007
    • 4

    safari select option onmouseover event

    It seems, at least as far as my tests show, that Safari does not fire onmouseover for select options.

    with the code below, I can get all the messages in Firefox, but none in Safari.
    If I attach a handler for the onmouseover to the select element (the part currently commented out) I can get the first mouseover of the select element, but not any additional ones. Again, in Firefox, I get all the messages, although they are handled by the selectorMouse function.

    Is this familiar to anyone, and are there any work-arounds?

    thanks in advance,
    Linus

    Code:
    <html>
        <head>
            <title>Woohoo</title>
            <script language="javascript" type="text/javascript">
                function selectorMouse(evt, selector) {
                    document.getElementById("msg").innerHTML="selector:"+evt.target.value;
                }
                function optionMouse(evt, option) {
                    document.getElementById("msg").innerHTML="option:"+evt.target.value;
                }
            </script>
        </head>
        <body>
            <div id="msg">&nbsp;</div>
            <select id='selector' name='selector' > <!-- onmouseover="selectorMouse(event, this)" -->
                <option id="option1" name="option1" value="op1v" onmouseover="optionMouse(event, this)">Option 1</option>
                <option id="option2" name="option2" value="op2v" onmouseover="optionMouse(event, this)">Option 2</option>
                <option id="option3" name="option3" value="op3v" onmouseover="optionMouse(event, this)">Option 3</option>
            </select>
        </body>
    </html>
    Last edited by Dormilich; Mar 24 '09, 06:56 AM. Reason: added [code] tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I don't think this works in IE either. Either create your own DHTML select object (simply not worth the effort) or just get the selected element and forget the option element mouse-over.

    Comment

    • linuskamb
      New Member
      • May 2007
      • 4

      #3
      yes, I had managed to fool myself regarding IE. I ended up using a CSS-based drop-down menu approach, as I needed to have the hover over the sub-items notice.

      thanks for the reply.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Since you needed it, that's the most reliable, cross-browser solution. Glad you got a working solution.

        Comment

        Working...