How to Use option to trigger mouseout in IE _ javascript tips-js tutorial

Source: Internet
Author: User
This article mainly introduces how to trigger mouseout with the mouse option in IE, and analyzes the window when the mouse moves to option in IE. event. the reason for toElement return value being null and its solution are as follows. Share it with you for your reference. The specific analysis is as follows:

Functions to be implemented:

There is a DIV. When the mouse passes, the DIV is fully expanded. When the mouse moves away, the DIV is shrunk back. The DIV contains a select box;

When the select operation is performed, a problem occurs in IE. When the mouse passes the option operation, the DIV will contract back, but this phenomenon is not found in other browsers.

Solution:

In IE, when the mouse moves to option, the value of window. event. toElement is null, and the value in other browsers is object;

When you move the cursor directly from the DIV, the value of window. event. toElement is object, and that of other browsers is also;

To sum up, you can add the following code in mouseout to solve the problem:

If (window. event. toElement = null) return;

I hope this article will help you design javascript programs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.