Microsoft KB Archive/254614

= BUG: Onmouseout Fires for SELECT When Cursor Still in Bounds =

Article ID: 254614

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0

-



This article was previously published under Q254614



SYMPTOMS
If you have an event handler set for the onmouseout event of an HTML SELECT element, this handler fires when you bring the cursor to rest inside the SELECT element.



RESOLUTION
Change your event handler to detect whether or not the onmouseout event being fired is accurate or not. You can do this by examining the value of window.event.toElement, which in this circumstance will be Nothing (in VBScript) or null (in JScript).



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
  Save the following HTML text to a file named testSelect.htm :

SELECT OnMouseOut Bug Reproduction sub SelectMouseOver window.status="Inside SELECT" end sub

sub SelectMouseOut window.status = "Outside SELECT" end sub

 Option 1 Option 2

 Load this file into Internet Explorer and put the cursor inside the SELECT element. The "Inside SELECT" text will appear briefly in the status bar, followed by the "Outside SELECT" text.  To avoid this, change your event handler to fire its code only when the toElement property of the event object is missing: sub SelectMouseOut if window.event.toElement is Nothing then window.status="Not really outside SELECT!" else window.status = "Outside SELECT" end if end sub If using Microsoft Jscript, phrase this conditional as: if (window.event.toElement == null) 

