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
|
function testfuckOne(){
$.get('https://www.heeeepin.com/json.php', function(data) {
var s = JSON.parse(data);
$('table[id$=DataGridA] tbody tr').each(function(index, el) {
var question = $(this).find('td table tr:nth(0) td span').text().replace(/\d+ 、/g,"");;
console.log(question);
if(s[question]){
if(s[question] instanceof Object){
for(x in s[question]){
$(this).find('td table tbody tr:nth(2) td table[id$=RBLBData] tbody tr').each(function(index, el) {
//如果选项和题目相等 则选中!
if($(this).find('td label').text().indexOf(s[question][x])!=-1){
$(this).find('input:checkbox').attr('checked', 'checked');
}
});
}
}else{
if(s[question]=="正确"){
$(this).find('table[id$=RBLCData]').find('input:radio').eq(0).attr('checked', 'checked');
}else if(s[question]=="错误"){
$(this).find('table[id$=RBLCData]').find('input:radio').eq(1).attr('checked', 'checked');
}else{
$(this).find('table[id$=RBLAData] tbody tr').each(function(index, el) {
if($(this).find('td label').text().indexOf(s[question])!=-1){
$(this).find('input:radio').attr('checked', 'checked');
}
});
}
console.log(s[question]);
}
}
});
});
//提交
setTimeout(function(){$('input[id=ctl00_ContentPlaceHolder1_btnOk]').click();},5000);
//下一页
$('input[id=ctl00_ContentPlaceHolder1_btnNext]').click();
}
```javascript
## `js`版自动练题就此诞生,又花了十来分钟搞定了100到练习题,终于可以开始我的考试了!!!!
----------
## 考试?!!? 考什么试 `Jquery`都学会了谁还考试啊
![fina.gif][5]
## 一键考试脚本
[Github欢迎Star][6]
```javascript
var importJs=document.createElement('script');
importJs.setAttribute("type","text/javascript");
importJs.setAttribute("src", "https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js");
document.getElementsByTagName("head")[0].appendChild(importJs);
setTimeout(fuck,1000);
function fuck(){
$.get('https://raw.githubusercontent.com/ghosx/git/master/json.json', function(data) {
console.log("get data success");
var s = JSON.parse(data);
$('table[id$=DataGridA] tbody tr').each(function(index, el) {
var question = $(this).find('td tbody tr:nth(0) td span').text().replace(/\d+ 、/g,"");
console.log(question);
if(s[question]){
console.log(s[question]);
var fuck1 = $(this).find('table[id$=RBLAData] tr td:nth(0) label');
var fuck2 = $(this).find('table[id$=RBLAData] tr td:nth(1) label');
var fuck3 = $(this).find('table[id$=RBLAData] tr td:nth(2) label');
var fuck4 = $(this).find('table[id$=RBLAData] tr td:nth(3) label');
if(fuck1.text().indexOf(s[question])!=-1){
$(this).find('table[id$=RBLAData] tbody tr input:radio').eq(0).attr('checked', 'checked');
}else if(fuck2.text().indexOf(s[question])!=-1){
$(this).find('table[id$=RBLAData] tbody tr input:radio').eq(1).attr('checked', 'checked');
}else if(fuck3.text().indexOf(s[question])!=-1){
$(this).find('table[id$=RBLAData] tbody tr input:radio').eq(2).attr('checked', 'checked');
}else if(fuck4.text().indexOf(s[question])!=-1){
$(this).find('table[id$=RBLAData] tbody tr input:radio').eq(3).attr('checked', 'checked');
}
}
});
$('table[id$=DataGridC] tbody tr').each(function(index, el) {
var que = $(this).find('span[id$=labCDataTitle]').text().replace(/\d+ 、/g,"");;
console.log(que);
if(s[que]){
console.log(s[que]);
if(s[que]=="正确"){
$(this).find('table[id$=RBLCData] tr td:nth(0) input:radio').attr('checked', 'checked');
}else if(s[que]=="错误"){
$(this).find('table[id$=RBLCData] tr td:nth(1) input:radio').attr('checked', 'checked');
}
}
});
});
alert("别呼吸~点击确定后倒数5秒奇迹将会发生")
}
|