-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs.js
90 lines (62 loc) · 1.56 KB
/
js.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
window.onload=function(){
var olli=document.getElementsByClassName("lst")
console.log(olli)
for(let i=0;i<olli.length;i++){
olli[i].onclick=function(){
for(let i=0;i<olli.length;i++){
olli[i].style.backgroundColor="gray"
}
olli[i].style.backgroundColor="red"
index=i;
goindex()
}
}
timer=setInterval(function(){
gonext()
changeLiColor()
}, 2000);
var obtn=document.getElementById("btn");
obtn.onclick=function(){
alert("功能尚未完善,敬请期待!")
}
var oqiandao=document.getElementById("qiandao");
oqiandao.onclick=function(){
oqiandao.innerHTML="已签到";
oqiandao.style.backgroundColor="gray"
}
var oright=document.getElementsByClassName("right");
oright[0].onclick=function(){
gonext()
console.log(index)
changeLiColor()
}
var oleft=document.getElementsByClassName("left");
oleft[0].onclick=function(){
gopre();
console.log(index)
changeLiColor()
}
}
var items=document.getElementsByClassName("image");
var index=0
function goindex(){
for(var i=0;i<items.length;i++){
items[i].classList.remove("active")
}
items[index].classList.add("active")
}
function gonext(){
goindex()
index==9?index=0:index++
}
function gopre(){
goindex()
index==0?index=9:index--
}
function changeLiColor(){
var oli=document.getElementsByClassName("lst")
for(var i=0;i<oli.length;i++){
oli[i].style.backgroundColor="gray"
}
oli[index].style.backgroundColor="red"
}