标签:
function insertAfter(ele,html){ var new_ele = document.createElement("div"); new_ele.innerHTML = html; var parent = ele.parentNode || document.body; parent.insertBefore(new_ele.firstChild, ele.nextSibling); } var d = document.getElementById("test"); insertAfter(d,"<div>dddddddd</div>")
var d = document.getElementById("test"); d.childNodes;//... d.previousSibling;//null d.nextSibling;//null d.parentNode;//body d.firstChild;//a d.lastChild;//b d.lastChild.textContent;//b d.lastChild.previousSibling.innerHTML;//Item4
标签:
原文地址:http://www.cnblogs.com/eturn/p/4558925.html