创建兼容 IE/FireFox 的 insertAdjacentHTML 方法

在 IE 中我们可以用 insertAdjacentHTML 往元素的 beforeBegin,beforeEnd,afterBegin,afterEnd 处理插入新元素。而在非 IE 中没有该方法,因而我们要创造一个兼容的 insertHtml 方法来。

本方法从 Ext 2 中剥离出来的,在 ext-all-debug.js 中有以下方法:

Ext.DomHelper.insertHtml( String where, HTMLElement el, String html ) : HTMLElement

参数介绍:

where:插入位置。包括beforeBegin,beforeEnd,afterBegin,afterEnd。
el:用于参照插入位置的html元素对象
html:要插入的html代码 阅读全文 >>