<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>js</title> <style> .box{ width:400px; height:400px; border:1px solid #ccc; background:pink; border-radius:200px; margin:100px auto; } </style> </head> <body> <div class="box" onmouseover="myimg(this)" onmouseout="img(this)"> </div> <script> function myimg(x){ x.style.background="blue"; } function img(y){ y.style.background="pink"; } </script> </body> </html>
总结:事件的简单了解还是不错的,需要我们多加练习!