久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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怎么設置元素css樣式

      設置方法:1、使用“對象.setAttribute('style', '屬性:值')”語句;2、使用“對象.style.setProperty('屬性', '值')”語句;3、使用“對象.style.cssText='屬性:值'”語句。

      js怎么設置元素css樣式

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

      方法1:使用setAttribute()

      <p id="p">hello world<p>  <button onclick="myFunction()">點擊按鈕,設置css樣式</button>  <script> function myFunction() { 	document.getElementById("p").setAttribute('style', 'color:#FF0000'); } </script>

      效果圖:

      js怎么設置元素css樣式

      方法2:使用setProperty()

      <p id="p">hello world<p>  <button onclick="myFunction()">點擊按鈕,設置css樣式</button>  <script> function myFunction() { 	document.getElementById("p").style.setProperty('font-size', '50px'); } </script>

      效果圖:

      js怎么設置元素css樣式

      方法3:cssText屬性

      <p id="p">hello world<p>  <button onclick="myFunction()">點擊按鈕,設置css樣式</button>  <script> function myFunction() { 	document.getElementById("p").style.cssText='font-size:50px;color: red;'; } </script>

      效果圖:

      js怎么設置元素css樣式

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

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