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

通過js來改變CSS樣式

オリジナル 2019-04-08 15:22:43 211
サマリー:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>js來改變一下樣式</title><style type="text/css">.box{width: 100px;height: 100px;background

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>js來改變一下樣式</title>

<style type="text/css">

.box{width: 100px;height: 100px;background: red;margin-bottom:20px ;}

.boxx{width: 100px;height: 300px;background: red; }

.boxxx{width: 300px;height: 300px;background: blue; }

</style>

</head>

<body>

<div></div>

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

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

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

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

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

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



<script type="text/javascript">

var box=document.getElementsByClassName('box')[0]

var box1=document.getElementsByTagName('div')[0]

function bg(num) {

box.className="boxx"

}

function bk(num) {

box.style.cssText="width: 200px;"

}

function bs(num) {

box1.style.background="blue"

}

function cz(num) {

box1.style.cssText="width: 100px;height: 100px;background: red;margin-bottom:20px ;"

}

function yc(num) {

box.style.display="none"

}

function xs(num) {

box.style.display="block"

}


</script>

</body>

</html>


添削の先生:查無此人添削時(shí)間:2019-04-08 16:04:39
先生のまとめ:完成的不錯(cuò)。每行js代碼,后面增加;號(hào)。繼續(xù)加油

手記を発表する

人気のある見出し語