📜  如何遍历 DOM - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:47.384000             🧑  作者: Mango

代码示例2
//Loop thru DOM elements

var all = document.getElementsByTagName("*");

for (var i=0, max=all.length; i < max; i++) {
     // Do something with the element here
}