-
Notifications
You must be signed in to change notification settings - Fork 0
/
domPractice.html
43 lines (37 loc) · 958 Bytes
/
domPractice.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DOM Practice JS</title>
<style>
.container {
width: 200px;
height: 200px;
background-color: #9f2525;
transition: 1s;
}
.grande {
width: 500px;
height: 500px;
background-color:aqua;
}
</style>
</head>
<body>
<button onClick="accion()">Cambio</button>
<br>
<div id="box" class="container"></div>
<script>
function accion() {
let box = document.getElementById("box");
if (box.className == "container"){
box.className = "container grande";
}else{
box.className = "container";
}
}
</script>
</body>
</html>