编辑下面的代码:【加编码】
<html> <body> <p>使用 the addEventListener() 方法向文档添加许多事件。</p> <p id="demo"></p> <script> document.addEventListener("mouseover", myFunction); document.addEventListener("click", mySecondFunction); document.addEventListener("mouseout", myThirdFunction); function myFunction() { document.getElementById("demo").innerHTML += "Moused over!<br>" } function mySecondFunction() { document.getElementById("demo").innerHTML += "Clicked!<br>" } function myThirdFunction() { document.getElementById("demo").innerHTML += "Moused out!<br>" } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂