编辑下面的代码:【加编码】
<html> <body> <script> function changeImage() { element=document.getElementById('myimage') if (element.src.match("bulbon")) { element.src="/static/images/pic_bulboff.gif"; } else { element.src="/static/images/pic_bulbon.gif"; } } </script> <img id="myimage" onclick="changeImage()" border="0" src="/static/images/pic_bulboff.gif" width="100" height="180"> <p>点击灯泡 开/关 灯</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂