JavaScript 更改 HTML 属性值
<button onclick="document.getElementById('myImage').src='https://img.8i5.net/image/bulboff.gif'">Turn on the light</button>
<img id="myImage" src="https://img.8i5.net/image/bulboff.gif" style="width:100px">
<button onclick="document.getElementById('myImage').src='https://img.8i5.net/image/bulboff.gif'">Turn off the light</button>
JavaScript 更改了标记的src(source) 属性的值:<img>
示例:
