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

JS修改ID屬性

オリジナル 2019-03-13 09:34:08 565
サマリー:<!doctype html><html><head><meta charset="utf-8"><title>JS-demo</title><style>#box{width:300px;height:300px; background:#D11619;}</style></

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>JS-demo</title>

<style>

#box{width:300px;height:300px; background:#D11619;}

</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="application/javascript">

var box

window.onload=function(){

box=document.getElementById('box')

}

function aa(){

box.style.height="400px"//屬性里不能加分號,一開始遇到這個錯誤。

}

function bb(){

box.style.width="400px"

}

function cc(){

box.style.background="pink"

}

function dd(){

box.style.height="300px"

box.style.width="300px"

box.style.background="#D11619"

}

function ee(){

box.style.display="none"

}

function ff(){

box.style.display="block"

}

</script>

</html>


添削の先生:韋小寶添削時間:2019-03-14 09:06:56
先生のまとめ:寫的很不錯 使用JavaScript動態(tài)的來修改標簽的樣式還可以做成動畫的效果

手記を発表する

人気のある見出し語