首页 > 开发 > Javascript > 正文

js 获取子节点函数 (兼容FF与IE)

2020-02-28 04:07:48
字体:
来源:转载
供稿:网友
代码如下:
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;
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表