<!DOCTYPE HTML><html><head> <meta charset="utf-8" /> <title>js2</title> <style type="text/css"> #div1 {width:300px; height:300px; background:blue; } </style> <script> function toGreen() {var change=document.getElementById('div1'); change.style.width='400px'; change.style.height='400px'; change.style.background='green'; } function toBlue() {var change=document.getElementById('div1'); change.style.width='300px'; change.style.height='300px'; change.style.background='blue'; } </script></head><body><div id="div1" onmouseover="toGreen" onmouseout="toBlue"></div></body></html>
1 回答
![?](http://img1.sycdn.imooc.com/545861c80001141e02200220-100-100.jpg)
慕神8447489
TA贡献1780条经验 获得超1个赞
<div id="div1" onmouseover="toBlue()" onmouseout="toGreen()">
var change = event.currentTarget;
添加回答
举报
0/150
提交
取消