<html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style type="text/css"> #div1 { width: 100px; height: 100px; background: red; } </style> <script> function togreen(){ var green=document.getElementById('div1'); green.style.width='200px'; green.style.height='200px'; green.style.background='green'; } function tored() { var green=document.getElementById('div1'); green.style.width='100px'; green.style.height='100px'; green.style.background='red'; } </script> </head> <body> <div id="div1" onMouseOver="togreen()" onMouseOut="tored()"> </div> </body> </html>
JavaScript实现鼠标效果
欢迎访问每天进步网:https://meitianjinbu.cn/