JS中如何给指定id中所有img设置class
2020-11-24 20:25:25
jQuery相关
<script> window.onload = function () { var img = document.getElementById("content").querySelectorAll("img"); for (var i = 0; i < img.leng
<script>
window.onload = function () {
var img = document.getElementById("content").querySelectorAll("img");
for (var i = 0; i < img.length; i++) {
img[i].setAttribute("class", "bigimg");
}
};
</script>
很赞哦! ()
相关文章
-
无相关信息
830*140广告