首页javascriptmousejQuery Event - 如何处理鼠标进入和鼠标离开事件

jQuery Event - 如何处理鼠标进入和鼠标离开事件

我们想知道如何处理鼠标进入和鼠标离开事件。


<html>
  <head>
    <script type="text/javascript" src='http://code.jquery.com/jquery-1.5.2.js'></script>
    <script type="text/javascript">
        $(document).ready(function(){
                $("div").bind("mouseenter mouseleave", function(e){
                  var str = "( " + e.pageX + ", " + e.pageY + " )";
                  console.log( str);
                });
        });
    </script>
    <style>
      div { width:50px; height:70px; float:left; margin:5px;
            background:rgb(255,140,0); cursor:pointer; }
    </style>
  </head>
  <body>
       <div>asdf</div>
  </body>
</html>