亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Js改變樣式

Original 2019-04-13 12:27:49 249
abstrakt:這節(jié)學(xué)到了JS取到DIV的值,并做相應(yīng)修改!<html>    <head>        <meta charset="UTF-8">        <title&g

這節(jié)學(xué)到了JS取到DIV的值,并做相應(yīng)修改!

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            #box{
                width:100px;
                height:100px;
                background:red;
            }
        </style>
    </head>
    <body>
        <div id="box"></div>
        <input type="button"value="height"onclick="aa()">
        <input type="button"value="width"onclick="bb()">
        <input type="button"value="color"onclick="cc()">
        <input type="button"value="back"onclick="dd()">
        <input type="button"value="move"onclick="ee()">
        <input type='button'value='show'onclick='ff()'>
       
    </body>
</html>
<script>
    var box;
     window.onload=function(){
         box=document.getElementById('box')
     }
      function aa(){
          box.style.height="500px";
      }
      function bb(){
          box.style.width="500px";
      }
      function cc(){
          box.style.background="yellow";
      }
     function dd(){
         box.style.height="100px";
         box.style.width="100px";
         box.style.background="red";
     }
     function ee(){
         box.style.display="none";
     }
     function ff(){
         box.style.display="block";
     }
    </script>

Korrigierender Lehrer:天蓬老師Korrekturzeit:2019-04-13 16:46:03
Zusammenfassung des Lehrers:獲取頁面元素, 是對頁面操作的第一步, 也是最關(guān)鍵的一步,如何來獲取, 有很多方式的時候, 一定要選最簡單的

Versionshinweise

Beliebte Eintr?ge