質問編集履歴
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,7 +48,9 @@
|
|
48
48
|
|
49
49
|
<p>
|
50
50
|
|
51
|
+
<input type="button" value="結果" onclick="result()"/>
|
52
|
+
|
51
|
-
結果:<span id="
|
53
|
+
結果:<span id="kekka"></span>
|
52
54
|
|
53
55
|
</p>
|
54
56
|
|
@@ -96,6 +98,20 @@
|
|
96
98
|
|
97
99
|
view.textContent=arr[pcnohand];
|
98
100
|
|
101
|
+
//console.log(arr[0]); //グー
|
102
|
+
|
103
|
+
// var pc0=arr.lastIndexOf('グー');
|
104
|
+
|
105
|
+
// var pc1=arr.lastIndexOf('チョキ');
|
106
|
+
|
107
|
+
// var pc2=arr.lastIndexOf('パー');
|
108
|
+
|
109
|
+
// console.log(pc0); //0
|
110
|
+
|
111
|
+
// console.log(pc1); //1
|
112
|
+
|
113
|
+
// console.log(pc2); //2
|
114
|
+
|
99
115
|
};
|
100
116
|
|
101
117
|
|
@@ -130,6 +146,8 @@
|
|
130
146
|
|
131
147
|
}
|
132
148
|
|
149
|
+
console.log("ユーザ:"+usernohand); //0,1,2
|
150
|
+
|
133
151
|
};
|
134
152
|
|
135
153
|
|
@@ -140,15 +158,15 @@
|
|
140
158
|
|
141
159
|
if(pc_hand(arr[0])-usernohand==0){
|
142
160
|
|
143
|
-
document.getElementById("
|
161
|
+
document.getElementById("kekka").innerHTML="あいこ";
|
144
162
|
|
145
163
|
}else if (pc_hand(arr[1])-usernohand==1) {
|
146
164
|
|
147
|
-
document.getElementById("
|
165
|
+
document.getElementById("kekka").innerHTML="あなたの勝ち";
|
148
166
|
|
149
167
|
}else if (pc_hand(arr[2])-usernohand==2) {
|
150
168
|
|
151
|
-
document.getElementById("
|
169
|
+
document.getElementById("kekka").innerHTML="あなたの負け";
|
152
170
|
|
153
171
|
}
|
154
172
|
|
@@ -164,7 +182,7 @@
|
|
164
182
|
|
165
183
|
document.getElementById("userhand").innerHTML="";
|
166
184
|
|
167
|
-
document.getElementById("
|
185
|
+
document.getElementById("kekka").innerHTML="";
|
168
186
|
|
169
187
|
};
|
170
188
|
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -138,15 +138,15 @@
|
|
138
138
|
|
139
139
|
function result(){
|
140
140
|
|
141
|
-
if(pc_hand(arr)-usernohand==0){
|
141
|
+
if(pc_hand(arr[0])-usernohand==0){
|
142
142
|
|
143
143
|
document.getElementById("result").innerHTML="あいこ";
|
144
144
|
|
145
|
-
}else if (pc_hand(arr)-usernohand==1) {
|
145
|
+
}else if (pc_hand(arr[1])-usernohand==1) {
|
146
146
|
|
147
147
|
document.getElementById("result").innerHTML="あなたの勝ち";
|
148
148
|
|
149
|
-
}else if (pc_hand(arr)-usernohand==2) {
|
149
|
+
}else if (pc_hand(arr[2])-usernohand==2) {
|
150
150
|
|
151
151
|
document.getElementById("result").innerHTML="あなたの負け";
|
152
152
|
|
1
文章,コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
ユーザの各手を0,1,2で表し,PCの手はarrの0,1,2で表して計算により勝ち負けを判定できると思ったのですが,今のところエラーや勝ち負けの結果も何も出ません.
|
8
8
|
|
9
|
-
|
9
|
+
どこがおかしいのでしょうか.
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -36,11 +36,11 @@
|
|
36
36
|
|
37
37
|
<p>
|
38
38
|
|
39
|
-
<input type="button" value="グー" onclick="serect_hand(
|
39
|
+
<input type="button" value="グー" onclick="serect_hand(0)"/>
|
40
40
|
|
41
|
-
<input type="button" value="チョキ" onclick="serect_hand(
|
41
|
+
<input type="button" value="チョキ" onclick="serect_hand(1)"/>
|
42
42
|
|
43
|
-
<input type="button" value="パー" onclick="serect_hand(
|
43
|
+
<input type="button" value="パー" onclick="serect_hand(2)"/>
|
44
44
|
|
45
45
|
あなたの手:<span id="userhand"></span>
|
46
46
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
<p>
|
50
50
|
|
51
|
-
結果:<span id="result">
|
51
|
+
結果:<span id="result"></span>
|
52
52
|
|
53
53
|
</p>
|
54
54
|
|
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
function serect_hand(usernohand){
|
106
106
|
|
107
|
-
if(usernohand==
|
107
|
+
if(usernohand==0){
|
108
108
|
|
109
109
|
document.getElementById("userhand").innerHTML="グー";
|
110
110
|
|
@@ -112,7 +112,7 @@
|
|
112
112
|
|
113
113
|
running=false;
|
114
114
|
|
115
|
-
}else if (usernohand==
|
115
|
+
}else if (usernohand==1) {
|
116
116
|
|
117
117
|
document.getElementById("userhand").innerHTML="チョキ";
|
118
118
|
|
@@ -120,7 +120,7 @@
|
|
120
120
|
|
121
121
|
running=false;
|
122
122
|
|
123
|
-
}else if (usernohand==
|
123
|
+
}else if (usernohand==2) {
|
124
124
|
|
125
125
|
document.getElementById("userhand").innerHTML="パー";
|
126
126
|
|
@@ -136,15 +136,23 @@
|
|
136
136
|
|
137
137
|
//結果:ユーザの勝敗
|
138
138
|
|
139
|
-
|
139
|
+
function result(){
|
140
140
|
|
141
|
-
|
141
|
+
if(pc_hand(arr)-usernohand==0){
|
142
142
|
|
143
|
-
|
143
|
+
document.getElementById("result").innerHTML="あいこ";
|
144
144
|
|
145
|
-
|
145
|
+
}else if (pc_hand(arr)-usernohand==1) {
|
146
146
|
|
147
|
+
document.getElementById("result").innerHTML="あなたの勝ち";
|
148
|
+
|
147
|
-
|
149
|
+
}else if (pc_hand(arr)-usernohand==2) {
|
150
|
+
|
151
|
+
document.getElementById("result").innerHTML="あなたの負け";
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
};
|
148
156
|
|
149
157
|
|
150
158
|
|
@@ -156,7 +164,7 @@
|
|
156
164
|
|
157
165
|
document.getElementById("userhand").innerHTML="";
|
158
166
|
|
159
|
-
|
167
|
+
document.getElementById("result").innerHTML="";
|
160
168
|
|
161
169
|
};
|
162
170
|
|
@@ -166,4 +174,6 @@
|
|
166
174
|
|
167
175
|
</html>
|
168
176
|
|
177
|
+
|
178
|
+
|
169
179
|
```
|