insertAdjacentHTML("beforeEnd", html的含义和用法

document.getElementById("nim")为:获得名称为nim的层。
insertAdjacentHTML("beforeEnd", html)为:
nim层在其后追加插入内容为< INPUT type="file" size="50" NAME="File"> 的html格式信息。

向下面的例子,可以拷贝到网页中试试:
<script>
   function addFile()
   {
       var str = '<INPUT type="file" size="50" NAME="File">'
      var nim = document.getElementById("nim")

  nim.insertAdjacentHTML("beforeEnd", html)

   }
  </script> 
<div id="nim">
1234567
</div>dfdfdfdf
<a href="javascript:addFile()">df</a>

原文地址:https://www.cnblogs.com/dexin/p/6400729.html