<html>
<body>
<img id="myImage" onclick="changeImage()" src="/i/eg_bulboff.gif" />
<p>单击灯泡打开/关闭灯。</p>
<script>
function changeImage() {
var image = document.getElementById('myImage');
if (image.src.match("bulbon")) {
image.src = "/i/eg_bulboff.gif";
} else {
image.src = "/i/eg_bulbon.gif";
}
}
</script>
</body>
</html>