简单教程
提交运行
代码编辑器:
<script> function lighton(){ document.getElementById('myimage').src="/static/i/javascript/basic/pic_bulbon.gif"; } function lightoff(){ document.getElementById('myimage').src="/static/i/javascript/basic/pic_bulboff.gif"; } </script> </head> <body> <img id="myimage" onmousedown="lighton()" onmouseup="lightoff()" src="/static/i/javascript/basic/pic_bulboff.gif" width="100" height="180" /> <p>点击不释放鼠标灯将一直亮着!</p>
运行结果: