サマリー:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>鼠標(biāo)移動(dòng)事件</title> <style type="text/css"> .box{ width: 200px;
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>鼠標(biāo)移動(dòng)事件</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>
添削の先生:天蓬老師添削時(shí)間:2018-12-31 16:13:54
先生のまとめ:你的這個(gè)事件有點(diǎn)簡(jiǎn)單, 其實(shí)用偽類:hover, 給這個(gè)元素添加上, 也能實(shí)現(xiàn)這樣的效果,不是嗎?試試看