W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <head> <script> function lighton() { document.getElementById('myimage').src = "/i/eg_bulbon.gif"; } function lightoff() { document.getElementById('myimage').src = "/i/eg_bulboff.gif"; } </script> </head> <body> <img id="myimage" onmousedown="lighton()" onmouseup="lightoff()" src="/i/eg_bulboff.gif" /> <p>点击鼠标并按住!</p> </body> </html>