JS.GetAllChild(element,deep,condition)使用介绍
代码如下:
window.GetAllChild = function (element, deep, condition) { if (!!!deep) { deep = 1; } if (!!!condition || condition == '') { condition = '1==1'; } deep--; if (!!!element || !!!element.childNodes || element.childNodes.length <= 0) { return []; } var result = new Array(); for (var i = 0; i < element.childNodes.length; i++) { if (element.style && (element.style.visibility == 'hidden' || element.style.display == 'none')) { continue; } var child = element.childNodes[i]; if (eval(condition)) { result.push(child); } if (deep > 0) { result = result.concat(GetAllChild(child, deep, condition)); } } return result; }
相关推荐
wikiwater 2020-10-27
阿斌Elements 2020-06-11
IdeaElements 2020-08-19
Sophiego 2020-08-16
Kakoola 2020-08-01
Kakoola 2020-07-29
ELEMENTS爱乐冬雨 2020-07-18
ELEMENTS爱乐小超 2020-07-04
ELEMENTS爱乐小超 2020-07-04
Kakoola 2020-06-28
Feastaw 2020-06-18
Wmeng0 2020-06-14
ELEMENTS爱乐冬雨 2020-06-14