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

完成控制DIV樣式-190329

原創(chuàng) 2019-03-29 11:12:29 284
摘要:// 改變css,還用了函數(shù)<!DOCTYPE html><html>    <head>        <meta charset="utf-8">           <title>控制DIV樣式

// 改變css,還用了函數(shù)


<!DOCTYPE html>

<html>

    <head>

        <meta charset="utf-8">   

        <title>控制DIV樣式</title>

        <style type='text/css'>

            #box{

                width:300px;

                height:300px;

                background:red;

                margin:20px 0;

            }

        </style>

    </head>

    <body>

        <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>

    <script type='text/javascript'>

        var box;

        window.onload=function (){

            box=document.getElementById("box");

        }

        function aa(){

            box.style.width = "600px";

        }

        function bb(){

            box.style.height = '600px';

        }

        function cc(){

            box.style.background = "black";

        }

        function dd(){

            box.style.height = '300px';

            box.style.width = '300px';

            box.style.background = 'red';

        }

        function ee(){

               box.style.display = "none";

        }   

        function ff(){

            box.style.display = "block";

        }     

    </script>

</html>

批改老師:天蓬老師批改時間:2019-03-29 14:17:38
老師總結(jié):你的js函數(shù)的功能, 如果很簡單的話, 實在沒有必要用函數(shù)的

發(fā)布手記

熱門詞條