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

JS控制DIV樣式

原創(chuàng) 2019-03-16 11:54:57 238
摘要:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>changeDIV</title><style>input{border: none;background: lightblue;border-

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>changeDIV</title>


<style>

input{border: none;background: lightblue;border-radius: 5px;font-size: 15px;}

#box{width: 200px;height: 200px;background: red;

text-align: center;line-height: 200px;

font-size:20px;margin: 50px;}




</style>

</head>

<body>

<!-- 用按鈕控制DIV的高度、寬度、顏色、重置、隱藏及顯示。 -->

<script>

var box

window.onload=function(){

box=document.getElementById('box')

}

function changeHeight(){

box.style.height="400px"  //改變高度

}

function changeWidth(){

box.style.width="400px"  //改變寬度

}

function changeColor(){

box.style.background="blue"  //改變顏色

}

function changeRadius(){

box.style.borderRadius="400px"  //改變形狀

}

function reset(){

box.style. height="200px"  //重置

box.style. width="200px"

box.style. background="red"  

box.style.borderRadius="0px"

}

function hide(){

box.style.display="none"  //隱藏

}

function display(){

box.style.display="block"  //顯示

}

</script>




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

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

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

<input type="button" value="變圓" onclick="changeRadius()">

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

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

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

<div id="box">變化無(wú)常</div>

</body>

</html>


批改老師:滅絕師太批改時(shí)間:2019-03-16 13:13:11
老師總結(jié):案例可以跳出老師上課代碼,自己找案例練習(xí)哦!

發(fā)佈手記

熱門詞條