-
Notifications
You must be signed in to change notification settings - Fork 7
/
rollcall.html
235 lines (230 loc) · 7.5 KB
/
rollcall.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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>点名啦</title>
<link rel="shortcut icon" href="assets/RollCall.ico" />
<style type="text/css">
<!--
*{margin: 0;padding: 0;}
a{text-decoration: none;}
ul,li{list-style: none;}
body{font-size: 14px;font-family: "微软雅黑";}
.button {
width:100px;
height:30px;
background:#E27575;
border:none;
border-radius:3px;
box-shadow:1px 1px 5px #B6B6B6;
color:#FFF;
display:inline-block;
cursor:pointer;
text-align:center;
text-shadow:1px 1px 1px #9E3F3F;
line-height:30px;
margin:10px;
}
.button:hover {
background: #CF7A7A;
}
#displayer{
width:500px;
height:165px;
background: #F7F7F7;
margin:auto;
margin-top:50px;
font-size:90px;
text-align:center;
}
#calllist p{
width:80%;
font-size:24px;
padding-left:20px;
}
thead{
background-color:rgb(255,200,100);
}
tbody{
background: rgb(225,225,225)
}
th,td{
width: 200px;
line-height: 25px;
text-align: center;
}
-->
</style>
</head>
<body>
<div id="Boxs" style="width:940px;height:530px;margin:auto;">
<div style="width:200px;height:100%;float:left;">
<table id="students" cellspacing=8>
<thead>
<tr>
<th>姓名</th>
<th>是否请假</th>
</tr>
</thead>
<tbody>
<tr>
<td>范一苇</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>罗梓烨</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>刘阳</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>冯艺超</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>刘畅</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>吴迪</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>刑晨</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>洪旸</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>朱彦頔</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>高格格</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>郭昱璇</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>张琬琦</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>叶睿旻</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>任怡萌</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>吴昆</td>
<td><input type="checkbox"/></td>
</tr>
<tr>
<td>替补1</td>
<td><input type="checkbox" checked="checked"/></td>
</tr>
<tr>
<td>替补2</td>
<td><input type="checkbox" checked="checked"/></td>
</tr>
</tbody>
</table>
</div>
<div style="width:500px;height:100%;float:left;margin:auto 20px;">
<div>
<p id="displayer"></p>
<div style="width:150px;height:50px;margin:auto;">
<span id="start" class="button">点名</span>
</div>
</div>
</div>
<div id="calllist" style="width:200px;height:90%;float:left;margin-top:20px;padding-top:25px;background:#DCDCDC;overflow:auto;overflow-x:hidden;">
<h3 style="padding-left:20px;">已点名单:</h3>
</div>
</div>
<script type="text/javascript">
function RollCall() {
var Displayer = document.getElementById("displayer");//显示器
var CallList = document.getElementById("calllist");//已点名单
var list;
var trS = 0;//数组下标
document.getElementById("start").onclick = function () {
Start();
};
/*LocalStorage*/
/* var LocalStr=function(key){
if(window.localStorage){
list=document.getElementById("list").value;
if(list!=""&&list!=" "){
var Strs=list.split("\n");
list=List(Strs);
if(localStorage.getItem(key)==(null||undefined))
localStorage.setItem(key,list);
}else{
Displayer.style.lineHeight="145px";
Displayer.innerHTML="<span style='font-size:70px;'>请先输入名单!</span>";//名单为空则显示提示
}
}else{
Displayer.style.lineHeight="";
Displayer.innerHTML="<span style='font-size:30px;'>抱歉,当前游览器不支持储存</span>";
}
}*/
/*开始*/
var Start = function () {
list = getTable();
console.log("list:" + list);
if (list.length != 0) {
Displayer.style.lineHeight = "165px";
Beat();
} else {
Displayer.style.lineHeight = "145px";
Displayer.innerHTML = "<span style='font-size:70px;'>请先输入名单!</span>";//名单为空则显示提示
}
}
var getTable = function () {
var table = document.getElementById("students");
var data = [];
for (var i = 1, rows = table.rows.length; i < rows; i++) {
if (!table.rows[i].cells[1].firstChild.checked) {
data.push(table.rows[i].cells[0].innerHTML);
}
}
return data;
}
/*循环列表*/
var Beat = function () {
var n = 0;
var m = list.length;
trS = parseInt(Math.random() * (m - n) + n);
Displayer.innerHTML = list[trS];
var p = document.createElement("p");
p.innerHTML = list[trS];
CallList.appendChild(p);
}
}
/*容器垂直居中*/
function Vertcal() {
var Div=document.getElementById('Boxs');
var WinHeight=0;
if (window.innerHeight)
WinHeight=window.innerHeight;
else if ((document.body)&&(document.body.clientHeight))
WinHeight=document.body.clientHeight;
if (document.documentElement&&document.documentElement.clientHeight)
WinHeight=document.documentElement.clientHeight;
Div.style.marginTop=(WinHeight-parseInt(Div.style.height))/2+'px';
}
RollCall();
window.onload=Vertcal;
window.onresize=Vertcal;
</script>
</body>
</html>