-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaidui.html
150 lines (147 loc) · 5.04 KB
/
paidui.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
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC强制全屏 -->
<meta name="full-screen" content="yes">
<!-- QQ强制全屏 -->
<meta name="x5-fullscreen" content="true">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<title>排队问题</title>
<style type="text/css">
tr:hover{background-color:#DDECF3;} /* 通过CSS实现鼠标悬停高亮色 */
.contentTitle{
background-color:beige;padding:15px;font-size:18px;
}
.contentRow{
padding:5px;font-family:Courier;font-size:20px;letter-spacing:5px;text-indent:20px;display: inline-block;vertical-align:middle;
}
td{
height: 51px;
}
</style>
<script type="text/javascript">
function g(m,n,k,type){
var _qianTxt="甲、乙二人排在一个队伍里。从前往后数甲排第m。".replace("m",m);
var _houTxt="从后往前数乙排第n。".replace("n",n);
var _jianGeTxt="甲、乙之间间隔k人。".replace("k",k);
var _typeTxt="甲在乙前。";
var _qTxt="问排队的总人数是多少人?";
var _answer="";
var _q="";
if (type==1) {
_typeTxt="甲在乙前。";
_q=_qianTxt+_houTxt+_typeTxt+_jianGeTxt+_qTxt;
_answer=m.toString()+"+"+n.toString()+"+"+k.toString();
_answer=_answer+"="+eval(_answer);
}else if (type==2){
_typeTxt="乙在甲前。";
_q=_qianTxt+_houTxt+_typeTxt+_jianGeTxt+_qTxt;
_answer=m.toString()+"+"+n.toString()+"-("+k.toString()+"+1+1)";
_answer=_answer+"="+eval(_answer)+"(人)";
}else if (type==3) {
_typeTxt="乙在甲前。";
_qTxt="甲乙之间最多间隔几人?";
_q=_qianTxt+_houTxt+_typeTxt+_qTxt;
_answer=eval(m.toString()+"<"+n.toString()
+"?"+m.toString()+":"
+n.toString())+"-1-1";
_answer=_answer+"="+eval(_answer);
};
return {
qu:_q,
ans:_answer
};
};
function getRed(m,n){
return Math.floor(Math.random()*(m-n+1)+n);
};
function createRow(que,i){
addNewTr("<div class='contentTitle' >"+"第 "+i+" 题"+"</div>");
addNewTr("<div class='contentRow' >"+que.qu+"</div>");
addNewTr("<div class='contentRow' style='display:none' ondblclick='JavaScript:this.style.display=\"\";'>"+que.ans+"</div>");
addNewTr("");
}
function check(rowId,answerA,answerB){
var answerAVal = document.getElementById("A"+rowId).value;
var answerBVal = document.getElementById("B"+rowId).value;
if (answerA==answerAVal && answerB==answerBVal) {
document.getElementById("mark"+rowId).innerHTML="<span style='color:green;font-size:14px'> √ 恭喜你回答正确!</span>"
+changeLevel("http://zxs731.github.io/index3_2.html","升一级");
}else{
document.getElementById("mark"+rowId).innerHTML="<span style='color:red;font-size:14px'> X 错误,再试一次吧!</span>"
+changeLevel("http://zxs731.github.io/index3_1.html","简单点");
}
}
function changeLevel(url,level){
return "<a href='"+url+"' style='color:green;font-size:14px'>"+level+"</a>";
};
function addNewTr(str){
var editTable=document.getElementById("tbody");
var tr4=document.createElement("tr");
var td4=document.createElement("td");
td4.innerHTML=str;
tr4.appendChild(td4);
editTable.appendChild(tr4);
}
function loadQuo(){
var s="";
for(var i=1;i<11;i++){
var s=getRed(0,4);
var it=g(getRed(5,20),getRed(5,20)
,getRed(2,5),s);
createRow(it,i);
}
console.log(s);
}
function getPicDiv(str){
var numx = getRandomInt(0, 10)*40;
var numy = getRandomInt(0, 10)*40;
var bordercolor="deepskyblue";
if (str=="A")
bordercolor="darkorange";
else if (str=="C") {
bordercolor="red";
};
var div ='<div style="display: inline-block;background: transparent url(2.jpg) no-repeat scroll -'+numx+'px -'+numy+'px;height: 40px;width: 40px;border-radius: 30px;vertical-align: middle;border-style:outset;border-color:'+bordercolor+'"></div>';
return div;
}
function getABCPics(){
var picA=getPicDiv('A');
var picB=getPicDiv('B');
var picC=getPicDiv('C');
while (picA==picB || picA==picC || picB==picC) {
picA=getPicDiv();
picB=getPicDiv();
picC=getPicDiv();
};
return {"A":picA,"B":picB,"C":picC};
}
</script>
</head>
<body onload="loadQuo();">
<table id="editTable" width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="gray" style="border-collapse:collapse;">
<tr>
<th><div style='padding:5px;font-size: 18px'>排队问题</div></th>
</tr>
<tbody id="tbody">
</tbody>
</table>
</body>
</html>