12345678910111213141516171819202122232425262728<!DOCTYPE html>charset="utf-8"W3Cschool教程(w3cschool.cn)function changeImage(){element=document.getElementById('myimage')if (element.src.match("bulbon")){element.src="/statics/images/course/pic_bulboff.gif";}else{element.src="/statics/images/course/pic_bulbon.gif";}}id="myimage" onclick="changeImage()"src="/statics/images/course/pic_bulboff.gif" width="100" height="180"点击灯泡就可以打开或关闭这盏灯