<div class="codetitle"> <span><a style="CURSOR: pointer" data="8155" class="copybut" id="copybut8155" onclick="doCopy('code8155')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code8155"> <br>//在现有元素后添加一个新元素 <br>function insertAfter(newElement, targetElement){ <br>var parent = targetElement.parentNode; <br>if (parent.lastChild == targetElement){ <br>parent.appendChild(newElement); <br>} else { <br>parent.insertBefore(newElement,targetElement.nextSibling); <br>} <br>} <br> </div>