📜  JavaScript 计数列表项 - Javascript 代码示例

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

代码示例2
var ul = document.getElementById("myul");
var liNodes = [];

for (var i = 0; i < ul.childNodes.length; i++) {
    if (ul.childNodes[i].nodeName == "LI") {
        liNodes.push(ul.childNodes[i]);
    }
}