質問編集履歴

1

修正

2019/05/30 08:25

投稿

sunagakuuun
sunagakuuun

スコア16

test CHANGED
File without changes
test CHANGED
@@ -23,241 +23,3 @@
23
23
 
24
24
 
25
25
  別件でクラスで指定すると用意されたNGワード入力フォームがまるごと消えてしまうと予想しているのですが、この予想が当たっている場合、それぞれ別々にhiddenしたいときどうすればいいのかも教えていただけるととてもうれしいです。
26
-
27
-
28
-
29
- ぐちゃぐちゃのソースコードで恐縮ですが、回答お願いします!
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- ```html,php,javascript
40
-
41
- <!DOCTYPE html>
42
-
43
- <html lang="ja">
44
-
45
- <head>
46
-
47
- <meta charset="UTF-8">
48
-
49
- <title>NG WORD</title>
50
-
51
- </head>
52
-
53
- <body>
54
-
55
- <h3>Please choose the number of people to play</h3>
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
- <form id="submit_form" name="ninzu_form" method="post" action="ngword.php"> <!--プレイヤー人数を決定するフォーム-->
66
-
67
- <select id="submit_select" name="ninzu"> <!--人数を2~6人の間で選ぶ-->
68
-
69
- <option value="">Please Select</option>
70
-
71
- <option value="2">2</option>
72
-
73
- <option value="3">3</option>
74
-
75
- <option value="4">4</option>
76
-
77
- <option value="5">5</option>
78
-
79
- <option value="6">6</option>
80
-
81
- </select>player
82
-
83
- <input type="submit" value="ENTER" onclick="clickEvent()"> <!--設定した人数をsubmit-->
84
-
85
- </form>
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
- <?php
96
-
97
-
98
-
99
- $ninzu = NULL; //$ninzuを初期化
100
-
101
- if(isset($_POST['ninzu_form'])){ //postされた人数を値として受け取る
102
-
103
- $ninzu = $_['ninzu_form']; //$ninzuにpostされた人数を代入
104
-
105
- }
106
-
107
- $count = filter_input(INPUT_POST, "ninzu"); //postされた人数を数値として$countに代入
108
-
109
-
110
-
111
- $j = 1; //$jの初期化
112
-
113
-
114
-
115
- echo <<< EOL
116
-
117
- <form id="submit_detail_form" name="detail_form" method="post" action="#">\n <!--プレイヤー名とNGword設定用のフォームを用意-->
118
-
119
- EOL;
120
-
121
-
122
-
123
- for($i = 0; $i < $count; $i++) #人数分のフォームを作るまで繰り返す
124
-
125
- {
126
-
127
- if($j > $i){
128
-
129
- echo <<< EOL
130
-
131
- Player{$j}
132
-
133
- <div>
134
-
135
- <input type="text" name="name_{$i}" value="" placeholder="PlayerName"> <!--プレイヤー名の設定-->
136
-
137
- </div>
138
-
139
-
140
-
141
- <div>
142
-
143
- <input type="text" class="kakusu" name="ng_{$i}" value="" placeholder="NG WORD"> <!--NGWORDの設定-->
144
-
145
- </div>
146
-
147
- <div>
148
-
149
- <input type="button" value="see" onclick="hyoji()">
150
-
151
- <input type="button" value="hide" onclick="hihyoji()">
152
-
153
- </div>
154
-
155
-
156
-
157
- EOL;
158
-
159
- $j++;
160
-
161
- }
162
-
163
- }
164
-
165
- echo <<< EOL
166
-
167
- \n<input type="button" id="startEn" value="START" onclick="clickEnter()"> <!--設定したプレイヤー名とNGWORDを送信-->
168
-
169
- </form>\n
170
-
171
- EOL;
172
-
173
-
174
-
175
- ?>
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
- <form name="form_count"><input name="counter" id="tmCounter" type="text" size="10"></form> <!--タイマーを表示するフォームの作成-->
188
-
189
-
190
-
191
-
192
-
193
- <script type="text/javascript">
194
-
195
-
196
-
197
- function hyoji(){
198
-
199
- document.getElementsByClassName("kakusu").style.visibility = "visible";
200
-
201
- }
202
-
203
-
204
-
205
-
206
-
207
- function hihyoji(){
208
-
209
- document.getElementsByClassName("kakusu").style.visibility = "hidden";
210
-
211
- }
212
-
213
-
214
-
215
-
216
-
217
- document.getElementById("tmCounter").style.visibility="hidden";
218
-
219
-
220
-
221
- document.getElementById("startEn").onclick = function(){
222
-
223
- document.getElementById("tmCounter").style.visibility="visible";
224
-
225
- }
226
-
227
-
228
-
229
-
230
-
231
- count = 180; //カウントの初期値
232
-
233
- timerID = setInterval('countdown()',1000); //1秒毎にcountup()を呼び出し
234
-
235
-
236
-
237
- function countdown() {
238
-
239
- count--; //カウントダウン
240
-
241
- document.form_count.counter.value = count;
242
-
243
- }
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
- </script>
256
-
257
-
258
-
259
- </body>
260
-
261
- </html>
262
-
263
- ```