请老师先查看代码是否正确,联系之前的讲过一个
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>mouse</title> <style type="text/css"> #div{overflow:auto;width:200px;height:200px;border:2px solid gray;margin-bottom:20px;} #content{width:200px;height:100px;border:2px solid gray;} </style> </head> <body> <div id="div"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod,tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo,consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse,cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non,proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </div> <div id="content"></div> <script type="text/javascript"> //补充代码 var wb=document.getElementById("div"); wb.onmousemove=function(){ wb.style.color="red"; } wb.onmouseout=function(){ wb.style.color="green"; } wb.onscroll=function(){ var xm=document.getElementById("content"); xm.innerHTML="内容滚动了"; } </script> </body> </html>
之前有讲过直接使用ele.onclick(或者onmousemove)之类的东西,并没有用ele.onmouseout=function(){}这样的函数,是怎么回事
0
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星