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

javascript控制div的樣式

original 2019-01-24 15:15:58 211
abstrait:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Javascript控制div的樣式</title>

<style>

#box{

width:100px;

height:100px;

background-color:lightblue;

}

</style>

</head>

<body>

<div id="box"></div>

<script>

document.getElementById('box').onclick = function() {

this.style.backgroundColor = 'orange';

this.style.borderRadius = '50%';

}

</script>

</body>

</html>


Professeur correcteur:天蓬老師Temps de correction:2019-01-24 17:23:04
Résumé du professeur:backgroundColor, 對于這樣的復合樣式, 注意語法 ,如果不想用屬性方式設置, 可以用setAttribute()

Notes de version

Entrées populaires