-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlottery-print-lucky.html
76 lines (74 loc) · 1.72 KB
/
lottery-print-lucky.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>中奖名单</title>
<link rel="stylesheet" href="css/lottery.bass.css">
<link rel="stylesheet" href="css/lottery.lucky.css" media="not print">
<link rel="stylesheet" href="css/lottery.print.css" media="print">
</head>
<body>
<div class="boundary">
<section>
<h1>中奖名单</h1>
<table>
<tr class="title">
<th>奖项</th>
<th>姓名</th>
<th>编号</th>
</tr>
</table>
</section>
</div>
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/lottery.js"></script>
<script type="text/javascript" src="js/lottery.localStorage.js"></script>
<script>
$(function(){
loadLucky();
});
var loadLucky = function(){
var table = $('table');
table.find('tr:not(.title)').remove();
reading('grand',1,table);
reading('first',3,table);
reading('second',6,table);
reading('third',120,table);
};
var reading = function(type,timer,obj){
var award;
if(type == 'grand'){
award = '特等奖';
}else if(type == 'first'){
award = '一等奖';
}else if(type == 'second'){
award = '二等奖';
}else if(type == 'third'){
award = '三等奖';
}
for(var i=0;i<timer;i++){
var people = lottery.localStorage.get(type+'_'+i);
if(people == ''){return true;}
people = people.split(",");
// if(i == 0){
// obj.append(
// '<tr>'
// +'<td class="pt10">'+award+'</td>'
// +'<td class="pt10">'+people[1]+'</td>'
// +'<td class="pt10">'+people[0]+'</td>'
// +'</tr>'
// );
// }else{
obj.append(
'<tr>'
+'<td>'+award+'</td>'
+'<td>'+people[1]+'</td>'
+'<td>'+people[0]+'</td>'
+'</tr>'
);
// }
}
}
</script>
</body>
</html>