标签:java 递归 asc child null ons fun dom console
结构:
<ul> <li>1</li> <li>2</li> <li>3</li> <li> 4 <ul> <li>a</li> <li>b</li> <li>c</li> </ul> </li> </ul>
js:
var d = null; function dg(dom) { for (var i =0, len = dom.length; i < len; i++) { d = dom[i] console.log(dom[i]) if (dom[i].children) { dg(dom[i].children) } } } dg(document.querySelector(‘ul‘).children)
标签:java 递归 asc child null ons fun dom console
原文地址:https://www.cnblogs.com/ly-qingqiu/p/12155888.html