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

JavaScript HTML DOM - CSS ??

JavaScript?? CSS? ???? ???? 4??? ????.

?? ??? ??(??? ???)

?? ??? ?? ID ??

? CSS ??

????? ??? ?? ??.

?? ? ?? ??? ???? ?? ?? ????. ?? ? ?? ??? ?? ?? ?? ??? ??? ? ??? ??? ? ???? ???? ????.

?? ??? ??(??? ???)

? ???? ???? ?? ????. ?? ??? ??? ??? ?? ???? ?? ???? ?? ??? ???? ??????. ???? ?? ?????.

var element = document.getElementById("test");

element.style.display = "none" //Hide the element

??? ?? CSS ???? ?????. name?font-size, background-image ? ?? ??? ???? ?? ??(-)? ???? ????. ??? JavaScript??? ??? "????"? ????? ??? ?? ??? ? ????. ?? ??. FontSize, backgroundImage? ?? ?? ??? ????? "camelCase"? ???? ???.

?? ?? ????? ??? ???? ??? ??? ?? ????. ?? ??, FontSize? ???? px, em, %(???) ?? ????.

Change class, id

id ? class? ??? ??? ?? "??"???. ?? ? ????? ??? ???? ???? ???????.

ID? ???? ??? ???? ?????, ??? ??? ???? ? ???? ??? ????? ? ??? ???? ?? ?? ?? ????. JavaScript? ??? ?? ????? ???? ??? ??? ? ????.

JavaScript?? ???? ??? ?????? ?? ???? ?????? className? ???? ?????. ?:

.redColor{

color: red;

}

. yellowBack {

background: yellow;

}

element.className = "redColor";//??? ??

element.className += "yellowBack";//??? ??


HTML ??? ???? ????? ????? ?? ??? ??????.

document.getElementById(id).style.property=new style

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
  <h1 id="id1">標(biāo)題</h1>
  <button type="button" onclick="document.getElementById('id1').style.color='blue'">點(diǎn)擊改變</button>
</body>
</html>


???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> function setSize() { document.getElementById("t2").style.fontSize = "30px"; } function setColor() { document.getElementById("t2").style.color = "red"; } function setbgColor() { document.getElementById("t2").style.backgroundColor = "blue"; } function setBd() { document.getElementById("t2").style.border = "3px solid #FA8072"; } </script> </head> <body> <div id="t2">歡迎光臨!</div> <p><button onclick="setSize()">大小</button> <button onclick="setColor()">顏色</button> <button onclick="setbgColor()">背景</button> <button onclick="setBd()">邊框</button> </p> </body> </html>