久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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)站

      javascript怎么改變元素寬高

      改變方法:1、使用“getElementById()”語句根據(jù)id值獲取元素對象;2、使用“元素對象.setAttribute("style","width:寬度值;height:高度值;")”語句改變元素寬高。

      javascript怎么改變元素寬高

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

      在javascript中,可以利用setAttribute() 方法來改變元素寬高。

      setAttribute() 方法添加或這種指定的屬性,并為其賦指定的值。如果這個指定的屬性已存在,則僅設置/更改值。

      語法:

      元素對象.setAttribute('屬性','屬性值');

      實現(xiàn)代碼:

      <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> div{ border: 1px solid red; } </style> </head> <body> <div id="div" style="width: 200px;height: 200px;"></div> <script> var div=document.getElementById("div"); div.setAttribute("style","width: 100px;height: 100px;"); </script> </body> </html>

      效果圖:

      javascript怎么改變元素寬高

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

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