fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"> </script> <script> x=0; y=0; $(document).ready(function(){ $("div.over").mouseover(function(){ $(".over span").text(x+=1); }); $("div.enter").mouseenter(function(){ $(".enter span").text(y+=1); }); }); </script> </head> <body> <p>mouseover 事件在鼠标移动到选取的元素及其子元素上时触发 。</p> <p>mouseenter 事件只在鼠标移动到选取的元素上时触发。 </p> <div class="over" style="background-color:lightgray;padding:20px;width:250px;float:left"> <h3 style="background-color:white;">Mouseover 事件触发: <span></span></h3> </div> <div class="enter" style="background-color:lightgray;padding:20px;width:250px;float:right"> <h3 style="background-color:white;">Mouseenter 事件触发: <span></span></h3> </div> </body> </html>
运行结果