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

控制div的樣式

Original 2019-02-16 23:46:10 267
abstrakt:<!DOCTYPE html><html><head>         <meta charset="utf-8">         <title>完成自己想做的事</title>   

<!DOCTYPE html>

<html>

<head>

         <meta charset="utf-8">

         <title>完成自己想做的事</title>

         <style type="text/css">

               #box{width: 200px;height: 200px;background: skyblue;margin:                          40px  100px;}

</style>

</head>

<body>

<script type="text/javascript">

       var box

       window.onload=function (){

            box=document.getElementById('box')

            }

         function aa() {

            box.style.height="600px"

            }

         function bb() {

             box.style.width="600px"

              }

          function cc() {

              box.style.background="black"

               }

           function dd() {

               box.style.height="200px"

               box.style.width="200px"

               box.style.background="pink"

            function ee() {

               box.style.display="none"

                }

            function ff() {

                box.style.display="block"

                }

</script>

<div id="box"></div>

<input type="button" value="變高" onclick="aa()">

<input type="button" value="變寬" onclick="bb()">

<input type="button" value="變色" onclick="cc()">

<input type="button" value="重置" onclick="dd()">

<input type="button" value="隱藏" onclick="ee()">

<input type="button" value="顯示" onclick="ff()">

</body>

</html>


對(duì)于第一步,先去把box給整合后,這樣很方便。就算繼續(xù)添加其他按鈕,也讓頁(yè)面中的代碼量沒(méi)有看起來(lái)那么龐大。

Korrigierender Lehrer:西門(mén)大官人Korrekturzeit:2019-02-17 09:55:39
Zusammenfassung des Lehrers:作業(yè)寫(xiě)的很好,思路也很好。以后寫(xiě)js代碼的時(shí)候最好加一下分號(hào)

Versionshinweise

Beliebte Eintr?ge