如何使用 JavaScript 修改视频元素的 poster
属性?
<video id="vid" poster="AB.png">
最佳答案
当然是:
document.getElementById("vid").setAttribute("poster","newValue");
使用 jQuery 将是:
jQuery("#vid").attr("poster","newValue");
同时也是一个 DOM property/id 属性:
document.getElementById("vid").poster = "newValue";
使用 jQuery 将是:
jQuery("#vid").prop("poster","newValue");
关于javascript - 使用 JavaScript 修改 DOM 元素属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19895441/