Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3424400
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:28:11+00:00 2026-05-18T06:28:11+00:00

Hi: when I add a mouseout event to a parent element,it seems that all

  • 0

Hi:
when I add a mouseout event to a parent element,it seems that all of its child are added this event also,it works well if the event is a mouse click and etc.

However for the mouseout event,this will cause some unexpected result.

Take a look at this example:

<html>
    <head>
        <script type="text/javascript">
            function init(){
                document.getElementById('par').onmouseout=function(){alert('mouse out')};
            }
    </script>
    </head>
    <body onload='init()'>
        <div id="par" style="width:400px;height:300px">
            <div style="background-color:red;width:100%;height:150px"></div>
            <div style="background-color:black;width:100%;height:150px"></div>
        </div>
    </body>
</html>

please Move from the red div to the black div,then move out of the black div,then you will get two alert window,I just want one.

So how to fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:28:12+00:00Added an answer on May 18, 2026 at 6:28 am

    That’s not possible using plain javascript without the mouseleave event, which, to my knowledge, is only supported by Internet Explorer.

    Javascript toolkits may provide a solution, jQuery for instance emulates that event:

    The mouseleave event differs from
    mouseout in the way it handles event
    bubbling. If mouseout were used in
    this example, then when the mouse
    pointer moved out of the Inner
    element, the handler would be
    triggered. This is usually undesirable
    behavior. The mouseleave event, on
    the other hand, only triggers its
    handler when the mouse leaves the
    element it is bound to, not a
    descendant. So in this example, the
    handler is triggered when the mouse
    leaves the Outer element, but not the
    Inner element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I add this code in my activity public boolean onKeyDown(int keyCode, KeyEvent event) {
I have a site with three tabs that I'm trying to dynamically add mouseover/mouseout
I have some code that adds mouseover events and mouseout events to all 'a'
Is there a way to add a mouseover/mouseout css class change to ALL buttons
tooltip = #tooltip; When adding marker to map I add a listener: google.maps.event.addListener(marker, 'mouseout',
I'm using a jquery slide menu that works great! I need to add a
$(#notification).slideDown(slow).delay(2000).slideUp(slow); .. works, but I want to add a condition so that if #notification
I add my page top link button like this: <a name=top></a> . . .
I add this class to library/My/Validate/PasswordConfirmation.php <?php require_once 'Zend/Validate/Abstract.php'; class My_Validate_PasswordConfirmation extends Zend_Validate_Abstract {
I add local maven repository, I add the local dependency in my project. this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.