控制div巩固

原创 2018-11-14 21:41:07 249
摘要:<!DOCTYPE html> <html> <head> <title>javaScript</title> <meta charset="utf-8">          </head><body>   

<!DOCTYPE html>

<html>

<head>

<title>javaScript</title>

<meta charset="utf-8">


        

</head>

<body>

     <div id="q" style="width:100px;height:100px;background:pink;margin:20px 80px;">

     </div>

     <input type="button" value="变高" onmouseover="b()">

     <input type="button" value="变长" onfocus="c()">

     <input type="button" value="变色" onclick="d()">

     <input type="button" value="重置" onmouseover="e()">

     <input type="button" value="隐藏" onfocus="f()">

     <input type="button" value="显示" onmouseover="g()">

<script type="text/javascript">

var q

window.onload=function () {

q=document.getElementById('q')

}

    function b() {

    q.style.height="150px"

}

    function c(){

     q.style.width="150px"

    }

    function d(){

    q.style.background="#000"

    }

    function e(){

    q.style.width="100px"

    q.style.height="100px"

        q.style.background="pink"

    }

    function f(){

    q.style.display="none"

    }

    function g(){

    q.style.display="block"

    }











</script>

    




</body>  

 </html>



批改老师:灭绝师太批改时间:2018-11-15 09:10:06
老师总结:完成的不错,学习到这个阶段,可以找一些案例做做练手!

发布手记

热门词条