jQuery ??? ??? mouseover() ? mouseout() ???
JS? ?? ?, ?? ???? ?? ????? ? ?? ??? ??? ?? ??? ??????? onmouseover() ? onmouseout() ???~
jQuery??? ???? move-in ? move-out ??? ?????? ???? ?????. mouseover() ? mouseout() ???? ???? ?????
?? ?? ???????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>mouseover()和mouseout()</title> <style type="text/css"> div{ width:200px; height:200px; border:1px solid #000; } </style> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> <div></div> <script> $("div").mouseover(function(){ $('div').css("background",'red'); }) $("div").mouseout(function(){ $('div').css("background",'green'); }) </script> </body> </html>
div ?? ?? ???? ??? ???? ????? ???, div ???? ???? ?? ???? ????