onMouseOver is called multiple times

Source: Internet
Author: User

when a container, such as Div , when no elements are included. Onmouseover is performed only once, normally. When this div contains other child elements, the event is executed several times, and today, this is the problem, and the solution is hereby documented.

This is because onmouseover Span style= "Font-family:helvetica" >ul li Span style= "Font-family:helvetica" >ul onmouseover

1 , if it is IE Browser, with OnMouseLeave instead.

2 , no matter what browser, the following method is very cool, do not believe, you try.

  1. ? statelist.onmouseout?=? function(e) {????
  2. ?? if(?! E?)? e?=?window.event;????
  3. ?? var? Reltg?=?e.relatedtarget??? e.relatedtarget?:?e.toelement;????
  4. ?? While (? reltg?&&?reltg?! =? This ?)? Reltg?=?reltg.parentnode;????
  5. ?? if(? reltg?! =? This ?) {????
  6. ?????? //?è?? E???? ˉt?? ¥?? –???? OnMouseLeave?? o?????? "? ¤"????? £????? ??
  7. ???? statelist.style.display=' None ';??
  8. ?}??
  9. }??

The original is here: http://blog.csdn.net/teresa502/article/details/6103458

onMouseOver is called multiple times

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.