久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      js如何去除html標簽

      javascript去除html標簽的方法:首先使用“document.getElementById(id值)”語句根據(jù)id值獲取指定html標簽對象;然后使用remove()方法刪除該標簽即可,語法格式為“標簽對象.remove()”。

      js如何去除html標簽

      本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版、Dell G3電腦。

      新建一個html文件,命名為test.html,用于講解如何使用js刪除html標簽。

      js如何去除html標簽

      在test.html文件內,使用p標簽創(chuàng)建多段文字,同時設置每個p標簽id屬性,主要用于下面使用js獲得對應的p標簽對象。

      js如何去除html標簽

      在test.html文件內,使用button標簽創(chuàng)建一個“刪除html”的按鈕。

      js如何去除html標簽

      在test.html文件內,給button按鈕綁定onclick點擊事件,當按鈕被點擊時,執(zhí)行delhtml()函數(shù)。

      js如何去除html標簽

      在test.html文件內,在js標簽內,創(chuàng)建delhtml()函數(shù),在函數(shù)內實現(xiàn)對指定的p標簽進行刪除。

      <>js如何去除html標簽

      在myfun()函數(shù)內,通過getElementById()方法獲得p標簽對象,使用remove()方法刪除html,例如,這里刪除id為p3的p標簽。

      js如何去除html標簽

      在瀏覽器中打開test.html文件,點擊按鈕,查看實現(xiàn)的效果。

      js如何去除html標簽

      js如何去除html標簽

      【推薦學習:javascript高級教程】

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號