摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>鼠標移動事件</title> <style type="text/css"> .box{ width: 200px;
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>鼠標移動事件</title> <style type="text/css"> .box{ width: 200px; height: 200px; border: 1px solid red; border-radius: 10px; } </style> </head> <body> <div onmousemove="mover(this)" onmouseout="out(this)"></div> <script type="text/javascript"> function mover(m){ m.style.backgroundColor="red"; m.style.borderRadius="100px"; } function out(o){ o.style.backgroundColor="blue"; o.style.borderRadius="10px"; } </script> </body> </html>
批改老師:天蓬老師批改時間:2018-12-31 16:13:54
老師總結(jié):你的這個事件有點簡單, 其實用偽類:hover, 給這個元素添加上, 也能實現(xiàn)這樣的效果,不是嗎?試試看