-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek6.js
59 lines (49 loc) · 1.52 KB
/
week6.js
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
49
50
51
52
53
54
55
56
57
58
59
function changeColor(){
var cColor = document.getElementsByClassName('color');
for (var i = 0; i < cColor.length; i++) {
cColor[i].style.color = '#f08080';
}
}
function makeBold(){
var bold = document.getElementsByClassName('bold');
for (var i = 0; i < bold.length; i++) {
bold[i].setAttribute('style', 'font-weight:700;');
}
}
function background(){
var background = document.getElementsByClassName('background');
for (var i = 0; i < background.length; i++) {
background[i].setAttribute('style', 'background-color:blue;');
}
}
function reset(){
var background = document.getElementsByClassName('background');
for (var i = 0; i < background.length; i++) {
background[i].setAttribute('style', 'background-color:white;');
}
var bold = document.getElementsByClassName('bold');
for (var i = 0; i < bold.length; i++) {
bold[i].setAttribute('style', 'font-weight:500;');
}
var cColor = document.getElementsByClassName('color');
for (var i = 0; i < cColor.length; i++) {
cColor[i].style.color = 'black';
}
}
var aColor = document.getElementById('box');
aColor.addEventListener("mouseover", hoverOn);
aColor.addEventListener("mouseout", hoverOff);
function hoverOn(){
aColor.style.backgroundColor = 'silver';
}
function hoverOff(){
aColor.style.backgroundColor = 'lightgreen';
}
var box = document.getElementById('boxA');
var anni = box.animate([
{ transform: 'translateY(50px)' },
{ transform: 'translateY(-500px)' }
], {
duration: 10000,
iterations: 4
});