DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> JS.GetAllChild(element,deep,condition)使用介紹
JS.GetAllChild(element,deep,condition)使用介紹
編輯:關於JavaScript     
復制代碼 代碼如下:
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;
}
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved