SOURCE

console 命令行工具 X clear

                    
>
console
function lighton()
{
document.getElementById('myimage').src="//www.w3school.com.cn/i/eg_bulbon.gif"
}
function lightoff()
{
document.getElementById('myimage').src="//www.w3school.com.cn/i/eg_bulboff.gif"
}
<img id="myimage" onmousedown="lighton()" onmouseup="lightoff()" src="//www.w3school.com.cn/i/eg_bulboff.gif" width="100" height="180"> 
 <p>请点击灯泡,把它点亮!</p>