insertAdjacentHTML方法:
element.insertAdjacentHTML(position,html);
element是指原組件,position是指插入html的位置艰毒,有四個參數(shù)可以選擇:
1.beforeEnd:原內(nèi)容之后加入新html.
2.beforeBegin:<div>之前加入新html.
3.afterBegin:原內(nèi)容之前加入新html.
4.afterEnd:</div>之后加入新html.
insertAdjacentHTML方法適用于所有HTML ?DOM組件距辆,這里以<div>組件進行說明伦吠。