<div id="b">bbbbbbbbb</div> <div>dddddd</div>
JavaScript
window.οnlοad=function(){var a =document.createElement("span");var b =document.createTextNode("cssrain");a.appendChild(b);var mubiao = document.getElementById("b");insertAfter(a,mubiao); }function insertAfter(newElement,targetElement) {var parent = targetElement.parentNode;if (parent.lastChild == targetElement) {// 如果最后的节点是目标元素,则直接添加。因为默认是最后parent.appendChild(newElement);} else {parent.insertBefore(newElement,targetElement.nextSibling);//如果不是,则插入在目标元素的下一个兄弟节点的前面。也就是目标元素的后面。}}