W3School TIY
脚 本 学 堂 www.jbxue.com
编辑您的代码:
<html> <head> <script type="text/javascript"> 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" width="100" height="180"> <p>请点击灯泡,把它点亮!</p> </body> </html>
查看结果: