By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,607 Members | 1,982 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,607 IT Pros & Developers. It's quick & easy.

safari select option onmouseover event

P: 4
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,

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title>Woohoo</title>
  4.         <script language="javascript" type="text/javascript">
  5.             function selectorMouse(evt, selector) {
  6.                 document.getElementById("msg").innerHTML="selector:";
  7.             }
  8.             function optionMouse(evt, option) {
  9.                 document.getElementById("msg").innerHTML="option:";
  10.             }
  11.         </script>
  12.     </head>
  13.     <body>
  14.         <div id="msg">&nbsp;</div>
  15.         <select id='selector' name='selector' > <!-- onmouseover="selectorMouse(event, this)" -->
  16.             <option id="option1" name="option1" value="op1v" onmouseover="optionMouse(event, this)">Option 1</option>
  17.             <option id="option2" name="option2" value="op2v" onmouseover="optionMouse(event, this)">Option 2</option>
  18.             <option id="option3" name="option3" value="op3v" onmouseover="optionMouse(event, this)">Option 3</option>
  19.         </select>
  20.     </body>
  21. </html>
Mar 23 '09 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 15k+
P: 16,027
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.
Mar 28 '09 #2

P: 4
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.
Mar 31 '09 #3

Expert Mod 15k+
P: 16,027
Since you needed it, that's the most reliable, cross-browser solution. Glad you got a working solution.
Apr 1 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.