質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,8 +40,6 @@
|
|
40
40
|
|
41
41
|
var counter=5;
|
42
42
|
|
43
|
-
var i;
|
44
|
-
|
45
43
|
var setTimer;
|
46
44
|
|
47
45
|
|
@@ -74,31 +72,29 @@
|
|
74
72
|
|
75
73
|
counter -= 1;
|
76
74
|
|
77
|
-
|
75
|
+
|
78
76
|
|
79
77
|
if(counter<0){
|
80
78
|
|
81
|
-
|
79
|
+
endscreen();
|
82
80
|
|
83
81
|
}
|
84
|
-
|
85
|
-
|
86
82
|
|
87
83
|
}
|
88
84
|
|
89
85
|
|
90
86
|
|
87
|
+
|
88
|
+
|
89
|
+
var clicknum;
|
90
|
+
|
91
91
|
function point(i){
|
92
|
-
|
93
|
-
var max=0;
|
94
92
|
|
95
93
|
var point=0;
|
96
94
|
|
97
|
-
var clicknum=0;
|
98
95
|
|
99
|
-
|
100
96
|
|
101
|
-
max = Math.max(document.g_switch.gs_1.value,document.g_switch.gs_2.value,document.g_switch.gs_3.value,document.g_switch.gs_4.value,document.g_switch.gs_5.value);
|
97
|
+
var max = Math.max(document.g_switch.gs_1.value,document.g_switch.gs_2.value,document.g_switch.gs_3.value,document.g_switch.gs_4.value,document.g_switch.gs_5.value);
|
102
98
|
|
103
99
|
|
104
100
|
|
@@ -106,17 +102,25 @@
|
|
106
102
|
|
107
103
|
point += document.g_switch.gs_i.value;
|
108
104
|
|
105
|
+
clicknum += 1;
|
106
|
+
|
109
107
|
}else if(document.g_switch.gs_i.value!=max){
|
110
108
|
|
111
109
|
point -= document.g_switch.gs_i.value;
|
112
110
|
|
113
111
|
}
|
114
112
|
|
113
|
+
}
|
115
114
|
|
116
115
|
|
117
|
-
clicknum = clicknum+1;
|
118
116
|
|
117
|
+
function endscreen(){
|
118
|
+
|
119
|
+
clearInterval(setTimer);
|
120
|
+
|
121
|
+
document.getElementById("show").innerHTML = clicknum;
|
122
|
+
|
119
|
-
}
|
123
|
+
}
|
120
124
|
|
121
125
|
|
122
126
|
|
@@ -146,6 +150,8 @@
|
|
146
150
|
|
147
151
|
|
148
152
|
|
153
|
+
<p id="show"></p>
|
154
|
+
|
149
155
|
</form>
|
150
156
|
|
151
157
|
</body>
|
@@ -156,6 +162,8 @@
|
|
156
162
|
|
157
163
|
|
158
164
|
|
165
|
+
|
166
|
+
|
159
167
|
コード
|
160
168
|
|
161
169
|
```
|
1
インデントを揃えました
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,97 +58,97 @@
|
|
58
58
|
|
59
59
|
function changenum(){
|
60
60
|
|
61
|
-
document.g_switch.gs_1.value = Math.floor (Math.random ( ) * 100)+1;
|
61
|
+
document.g_switch.gs_1.value = Math.floor (Math.random ( ) * 100)+1;
|
62
62
|
|
63
|
-
document.g_switch.gs_2.value = Math.floor (Math.random ( ) * 100)+1;
|
63
|
+
document.g_switch.gs_2.value = Math.floor (Math.random ( ) * 100)+1;
|
64
64
|
|
65
|
-
document.g_switch.gs_3.value = Math.floor (Math.random ( ) * 100)+1;
|
65
|
+
document.g_switch.gs_3.value = Math.floor (Math.random ( ) * 100)+1;
|
66
66
|
|
67
|
-
document.g_switch.gs_4.value = Math.floor (Math.random ( ) * 100)+1;
|
67
|
+
document.g_switch.gs_4.value = Math.floor (Math.random ( ) * 100)+1;
|
68
68
|
|
69
|
-
document.g_switch.gs_5.value = Math.floor (Math.random ( ) * 100)+1;
|
69
|
+
document.g_switch.gs_5.value = Math.floor (Math.random ( ) * 100)+1;
|
70
70
|
|
71
71
|
|
72
72
|
|
73
|
-
document.g_switch.timer.value = counter;
|
73
|
+
document.g_switch.timer.value = counter;
|
74
74
|
|
75
|
-
counter -= 1;
|
75
|
+
counter -= 1;
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
if(counter<0){
|
80
|
+
|
81
|
+
clearInterval(setTimer);
|
82
|
+
|
83
|
+
}
|
76
84
|
|
77
85
|
|
78
|
-
|
79
|
-
if(counter<0){
|
80
|
-
|
81
|
-
clearInterval(setTimer);
|
82
86
|
|
83
87
|
}
|
84
88
|
|
85
89
|
|
86
90
|
|
91
|
+
function point(i){
|
92
|
+
|
87
|
-
|
93
|
+
var max=0;
|
94
|
+
|
95
|
+
var point=0;
|
96
|
+
|
97
|
+
var clicknum=0;
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
max = Math.max(document.g_switch.gs_1.value,document.g_switch.gs_2.value,document.g_switch.gs_3.value,document.g_switch.gs_4.value,document.g_switch.gs_5.value);
|
88
102
|
|
89
103
|
|
90
104
|
|
91
|
-
fun
|
105
|
+
if(document.g_switch.gs_i.value==max){
|
92
106
|
|
93
|
-
|
107
|
+
point += document.g_switch.gs_i.value;
|
94
108
|
|
95
|
-
|
109
|
+
}else if(document.g_switch.gs_i.value!=max){
|
96
110
|
|
97
|
-
|
111
|
+
point -= document.g_switch.gs_i.value;
|
112
|
+
|
113
|
+
}
|
98
114
|
|
99
115
|
|
100
116
|
|
101
|
-
|
117
|
+
clicknum = clicknum+1;
|
118
|
+
|
119
|
+
}
|
102
120
|
|
103
121
|
|
104
122
|
|
105
|
-
|
123
|
+
</script>
|
106
124
|
|
107
|
-
|
125
|
+
</head>
|
108
126
|
|
109
|
-
|
127
|
+
<body>
|
110
128
|
|
111
|
-
|
129
|
+
<form name="g_switch">
|
112
|
-
|
113
|
-
}
|
114
130
|
|
115
131
|
|
116
132
|
|
117
|
-
|
133
|
+
<input type="button" name="timer" value="start" onclick="startTimer()" style="widht:50px; height: 50px; font-size:20px;">
|
118
134
|
|
119
|
-
|
135
|
+
<p>
|
136
|
+
|
137
|
+
<input type="button" name="gs_1" value="SW1" onclick="point(1)" style="widht:50px; height: 50px; font-size:20px;">
|
138
|
+
|
139
|
+
<input type="button" name="gs_2" value="SW2" onclick="point(2)" style="widht:50px; height: 50px; font-size:20px;">
|
140
|
+
|
141
|
+
<input type="button" name="gs_3" value="SW3" onclick="point(3)" style="widht:50px; height: 50px; font-size:20px;">
|
142
|
+
|
143
|
+
<input type="button" name="gs_4" value="SW4" onclick="point(4)" style="widht:50px; height: 50px; font-size:20px;">
|
144
|
+
|
145
|
+
<input type="button" name="gs_5" value="SW5" onclick="point(5)" style="widht:50px; height: 50px; font-size:20px;">
|
120
146
|
|
121
147
|
|
122
148
|
|
123
|
-
</
|
149
|
+
</form>
|
124
150
|
|
125
|
-
</head>
|
126
|
-
|
127
|
-
<body>
|
128
|
-
|
129
|
-
<form name="g_switch">
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<input type="button" name="timer" value="start" onclick="startTimer()" style="widht:50px; height: 50px; font-size:20px;">
|
134
|
-
|
135
|
-
<p>
|
136
|
-
|
137
|
-
<input type="button" name="gs_1" value="SW1" onclick="point(1)" style="widht:50px; height: 50px; font-size:20px;">
|
138
|
-
|
139
|
-
<input type="button" name="gs_2" value="SW2" onclick="point(2)" style="widht:50px; height: 50px; font-size:20px;">
|
140
|
-
|
141
|
-
<input type="button" name="gs_3" value="SW3" onclick="point(3)" style="widht:50px; height: 50px; font-size:20px;">
|
142
|
-
|
143
|
-
<input type="button" name="gs_4" value="SW4" onclick="point(4)" style="widht:50px; height: 50px; font-size:20px;">
|
144
|
-
|
145
|
-
<input type="button" name="gs_5" value="SW5" onclick="point(5)" style="widht:50px; height: 50px; font-size:20px;">
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
</form>
|
150
|
-
|
151
|
-
</body>
|
151
|
+
</body>
|
152
152
|
|
153
153
|
</html>
|
154
154
|
|