-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
48 lines (40 loc) · 1.28 KB
/
Copy pathjavascript.js
File metadata and controls
48 lines (40 loc) · 1.28 KB
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
44
45
46
47
48
var box = document.getElementById("box")
box.style.opacity = 1
document.getElementById("button1").addEventListener("click", function(){
var ht = parseFloat(box.style.height)
var wd = parseFloat(box.style.width)
box.style.height = ht + 10 + "px"
box.style.width = ht + 10 + "px"
})
document.getElementById("button2").addEventListener("click", function(){
if (box.style.backgroundColor == "orange") {
box.style.backgroundColor = "blue"
return
}
if (box.style.backgroundColor == "blue") {
box.style.backgroundColor = "cyan"
return
}
if (box.style.backgroundColor == "cyan") {
box.style.backgroundColor = "navy"
return
}
if (box.style.backgroundColor == "navy") {
box.style.backgroundColor = "aqua"
return
}
if (box.style.backgroundColor == "aqua") {
box.style.backgroundColor = "blue"
return
}
})
document.getElementById("button3").addEventListener("click", function(){
var op = parseFloat(box.style.opacity)
box.style.opacity = op - 0.04
})
document.getElementById("button4").addEventListener("click", function(){
box.style.opacity = 1
box.style.height = "150px"
box.style.width = "150px"
box.style.backgroundColor = "orange"
})