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

javascript控制div樣式

Original 2019-04-17 12:52:49 292
abstrakt:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml&quo

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>無標(biāo)題文檔</title>


<script type="text/javascript">

var box

window.onload = function(){

box = document.getElementById("box")

}



function aa() {

box.style.height="400px";

}


function bb() {

box.style.width="500px";

}


function cc() {

box.style.background="red";

}


function dd() {

box.style.height="300px";

box.style.width="300px";

box.style.background="#ccc";

}



function ee() {

box.style.display="none" }



function ff() {

box.style.display="block" }



</script>



<style type="text/css">

#box{ width:300px; height:300px; background-color:#ccc; margin:20px;}


</style>


</head>


<body>

<p>js學(xué)習(xí)</p>



<div id = "box">    

</div>


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

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

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

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

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

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


</body>

</html>


Korrigierender Lehrer:天蓬老師Korrekturzeit:2019-04-17 13:46:38
Zusammenfassung des Lehrers:function ff() { box.style.display="block" } 盡管js允許省略后面的分號, 但是如何你省略就全部都不要寫, 不要一會寫, 一會不寫, 要保持 統(tǒng)一的風(fēng)格

Versionshinweise

Beliebte Eintr?ge