日期:2014-05-16 浏览次数:20527 次
// 一 扩展HTMLElement的prototype HTMLElement.prototype.insertAfter = function(newNode, refNode) { if(refNode.nextSibling) { return this.insertBefore(newNode, refNode.nextSibling); } else { return this.appendChild(newNode); } } // 二 扩展Node的prototype Node.prototype.insertAfter = function(newNode, refNode) { if(refNode.nextSibling) { return this.insertBefore(newNode, refNode.nextSibling); } else { return this.appendChild(newNode); } }