DOM节点相关操作(兼容)
//获取元素子节点
function getChild(parent) {
var childs = parent.childNodes,
result = [];
for (var i = 0; cl = childs.length, i < cl; i++) {
if(childs[i].nodeType == 1) {
result.push(childs[i])
}
};
return result;
};
//插入某个元素之后
function insertAfter(newEle, tagEle) { var parent = tagEle.parentNode; if (parent.lastChild == tagEle) { parent.appendChild(newEle) } else { tagEle.nextSibling.insertBefore(newEle) } }