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>

示例:

©️李联华的博客网 当前IP地址:3.138.119.142,归属地:俄亥俄州Dublin ,欢迎您的访问!

温馨提示 : 非特殊注明,否则均为李联华的博客原创文章,本站文章未经授权禁止任何形式转载
文章链接:https://www.ooize.com/javascript-changes-the-html-attribute-value.html
订阅
提醒
guest
0 评论
内联反馈
查看所有评论
Loading...