js 获取子节点函数 (兼容FF与IE)
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:functiongetFirstChild(obj){varresult=obj.firstChild;while(!re...
复制代码 代码如下:
function getFirstChild(obj) {
var result = obj.firstChild;
while (!result.tagName) {
result = result.nextSibling;
}
return result;
}
function getNextChild(obj) {
var result = obj.nextSibling;
while (!result.tagName) {
result = result.nextSibling;
}
return result;
}