JS鼠标效果

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Document</title>
 6     <style type="text/css">
 7         #div1{
 8             width: 200px;
 9             height: 50px;
10             background-color: orange;
11         }
12     </style>
13     <script type="text/javascript">
14     function toGreen(){
15         document.getElementById('div1').style.background='green';
16     }
17     function toOrange(){
18         document.getElementById('div1').style.background='orange';
19     }
20     </script>
21 </head>
22 <body>
23     <div id="div1" onmouseover="toGreen()" onmouseout="toOrange()"></div>
24 </body>
25 </html>

 

posted @ 2019-09-06 14:14  New7  阅读(404)  评论(0编辑  收藏  举报