改变div大小和颜色

来源:互联网 发布:recyclerview性能优化 编辑:程序博客网 时间:2024/05/16 10:09
<!DOCTYPE html><html><head><meta charset="UTF-8"><title></title><style>.div1 {width: 200px;height: 200px;background: red;transition: 1s;}</style><script>window.onload = function() {var oDiv1 = document.getElementById("div1");oDiv1.onmouseover = function() {oDiv1.style.width = "400px";oDiv1.style.height = "400px";oDiv1.style.background = "green";}oDiv1.onmouseout = function() {// oDiv1.style.width = "200px";// oDiv1.style.height = "200px";// oDiv1.style.background = "red";oDiv1.style = "oDiv1.style";}}</script></head><body><div class="div1" id="div1"></div></body></html>

0 0
原创粉丝点击