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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM