質問編集履歴

5

最新のコードを載せました

2018/06/21 08:34

投稿

javabeginar
javabeginar

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,19 +1,9 @@
1
- ```html/javascript
1
+ "HTML" "JavaScript"
2
+
3
+ ```
2
4
 
3
5
  コード
4
6
 
5
-
6
-
7
- <!DOCTYPE html>
8
-
9
- <html>
10
-
11
- <head>
12
-
13
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
14
-
15
- <jsp:include page="header1.jsp" />
16
-
17
7
  <Script>
18
8
 
19
9
  <!--
@@ -22,13 +12,15 @@
22
12
 
23
13
  {
24
14
 
25
- label1.innerHTML = document.f.nam.value;
15
+ label1.innerHTML = document.f.nam.value;
26
-
16
+
27
- label2.innerHTML = document.f.namae.value;
17
+ label2.innerHTML = document.f.namae.value;
28
-
18
+
29
- label3.innerHTML = document.f.mail.value;
19
+ label3.innerHTML = document.f.mail.value;
30
-
20
+
31
- }
21
+ }
22
+
23
+
32
24
 
33
25
  function shwSelect()
34
26
 
@@ -58,10 +50,38 @@
58
50
 
59
51
  }
60
52
 
53
+
54
+
61
55
  function FormSubmit() {
62
56
 
63
57
  var target = document.getElementById("search");
64
58
 
59
+ // 追加。
60
+
61
+ document.getElementById('s1').value = document.f.nam.value;
62
+
63
+ document.getElementById('s2').value = document.f.namae.value;
64
+
65
+ document.getElementById('s3').value = document.f.mail.value;
66
+
67
+ document.getElementById('s4').value = document.f.depart.value;
68
+
69
+ document.getElementById('s5').value = document.f.title.value;
70
+
71
+ target.method = "post";
72
+
73
+ target.submit();
74
+
75
+ }
76
+
77
+
78
+
79
+
80
+
81
+ function FormExport() {
82
+
83
+ var target = document.getElementById("export");
84
+
65
85
  document.getElementsByName("nam")[0].value = document.getElementsByName("nam")[0].value
66
86
 
67
87
  document.getElementsByName("namae")[0].value = document.getElementsByName("namae")[0].value
@@ -78,27 +98,33 @@
78
98
 
79
99
  }
80
100
 
101
+
102
+
103
+
104
+
81
105
  -->
82
106
 
83
107
  </Script>
84
108
 
85
-
86
-
87
- <title>管理システム</title>
109
+ <title>社員管理システム</title>
88
110
 
89
111
  </head>
90
112
 
91
113
  <body>
92
114
 
93
- <jsp:include page="nav1.jsp" />
115
+ <jsp:include page="nav1.jsp" />
94
116
 
95
117
  <form name="f" action="">
96
118
 
97
119
  <div class="containers">
98
120
 
121
+
122
+
99
123
  <table class="table">
100
124
 
125
+
126
+
101
- <tr>
127
+ <tr>
102
128
 
103
129
  <th>従業員名</th>
104
130
 
@@ -110,6 +136,8 @@
110
136
 
111
137
  </tr>
112
138
 
139
+
140
+
113
141
  <tr>
114
142
 
115
143
  <th>従業員名(フリガナ)</th>
@@ -194,40 +222,36 @@
194
222
 
195
223
  </div>
196
224
 
225
+
226
+
197
227
    <input type="button" name="btn" value="確認" onClick="fncDisp(), shwSelect()">
198
228
 
199
229
  </form>
200
230
 
201
-
202
-
203
-
204
-
205
-
206
-
207
231
  <form id="search" action="search" method="POST">
208
232
 
209
-
210
-
211
- <input type="hidden" id="label1" type="text" />
233
+ <input type="hidden" id="s1" name="label1" />
212
-
234
+
213
- <input type="hidden" id="label2" type="text" />
235
+ <input type="hidden" id="s2" name="label2" />
214
-
236
+
215
- <input type="hidden" id="label3" type="text" />
237
+ <input type="hidden" id="s3" name="label3" />
216
-
238
+
217
- <input type="hidden" id="label4" type="text" />
239
+ <input type="hidden" id="s4" name="label4" />
218
-
240
+
219
- <input type="hidden" id="label5" type="text" />
241
+ <input type="hidden" id="s5" name="label5" />
220
-
242
+
243
+
244
+
221
- <input class="btn btn-success center-block" value="検索" onClick="FormSubmit();" />
245
+ <input class="btn btn-success center-block" name="search" value="検索" onClick="FormSubmit();" />
222
-
223
-
224
-
225
-
226
246
 
227
247
  </form>
228
248
 
229
249
  <br />
230
250
 
251
+
252
+
253
+
254
+
231
255
  ```
232
256
 
233
257
 
@@ -259,3 +283,9 @@
259
283
  ソースが間違っているのか、JSPにJavaScriptを入れると正確に動作しないのでしょうか。
260
284
 
261
285
  よろしくお願いいたします。
286
+
287
+
288
+
289
+ 追記
290
+
291
+ 17:32 最新のコードを載せました。

4

変更

2018/06/21 08:34

投稿

javabeginar
javabeginar

スコア13

test CHANGED
File without changes
test CHANGED
@@ -259,237 +259,3 @@
259
259
  ソースが間違っているのか、JSPにJavaScriptを入れると正確に動作しないのでしょうか。
260
260
 
261
261
  よろしくお願いいたします。
262
-
263
-
264
-
265
-
266
-
267
- ### 該当のソースコード
268
-
269
-
270
-
271
- <!DOCTYPE html>
272
-
273
- <html>
274
-
275
- <head>
276
-
277
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
278
-
279
- <jsp:include page="header1.jsp" />
280
-
281
- <Script>
282
-
283
- <!--
284
-
285
- function fncDisp()
286
-
287
- {
288
-
289
- label1.innerHTML = document.f.nam.value;
290
-
291
- label2.innerHTML = document.f.namae.value;
292
-
293
- label3.innerHTML = document.f.mail.value;
294
-
295
- }
296
-
297
- function shwSelect()
298
-
299
- {
300
-
301
- //セレクトボックスの値(数値)を取得
302
-
303
- var num = document.f.depart.selectedIndex;
304
-
305
- // 値(value値)を取得
306
-
307
- var str = document.f.depart.options[num].value;
308
-
309
- document.getElementById("label4").innerHTML = str;
310
-
311
-
312
-
313
- //セレクトボックスの値(数値)を取得
314
-
315
- var num = document.f.title.selectedIndex;
316
-
317
- // 値(value値)を取得
318
-
319
- var str = document.f.title.options[num].value;
320
-
321
- document.getElementById("label5").innerHTML = str;
322
-
323
- }
324
-
325
- function FormSubmit() {
326
-
327
- var target = document.getElementById("search");
328
-
329
- document.getElementsByName("nam")[0].value = document.getElementsByName("nam")[0].value
330
-
331
- document.getElementsByName("namae")[0].value = document.getElementsByName("namae")[0].value
332
-
333
- document.getElementsByName("mail")[0].value = document.getElementsByName("mail")[0].value
334
-
335
- document.getElementsByName("depart")[0].value = document.getElementsByName("depart")[0].value
336
-
337
- document.getElementsByName("title")[0].value = document.getElementsByName("title")[0].value
338
-
339
- target.method = "post";
340
-
341
- target.submit();
342
-
343
- }
344
-
345
- -->
346
-
347
- </Script>
348
-
349
-
350
-
351
- <title>管理システム</title>
352
-
353
- </head>
354
-
355
- <body>
356
-
357
- <jsp:include page="nav1.jsp" />
358
-
359
- <form name="f" action="">
360
-
361
- <div class="containers">
362
-
363
- <table class="table">
364
-
365
- <tr>
366
-
367
- <th>従業員名</th>
368
-
369
- <td>
370
-
371
- <span id="label1"></span>
372
-
373
- <input type="text" name="nam" value="<c:out value="${dto.nam}" />" maxlength="128" size="60"/></td>
374
-
375
- </tr>
376
-
377
- <tr>
378
-
379
- <th>従業員名(フリガナ)</th>
380
-
381
- <td>
382
-
383
- <span id="label2"></span>
384
-
385
- <input type="text" name="namae" value="<c:out value="${dto.namae}" />" maxlength="128" size="60"/></td>
386
-
387
- </tr>
388
-
389
- <tr>
390
-
391
- <th>メールアドレス</th>
392
-
393
- <td><span id="label3"></span>
394
-
395
- <input type="text" name="mail" value="<c:out value="${dto.mail}" />" maxlength="128" size="60"/></td>
396
-
397
- </tr>
398
-
399
- <tr>
400
-
401
- <th>部署</th>
402
-
403
- <td><span id="label4"></span>
404
-
405
- <select name="depart">
406
-
407
- <option value="">選択してください</option>
408
-
409
- <option value="システム事業部">システム事業部</option>
410
-
411
- <option value="活用事業部">活用事業部</option>
412
-
413
- <option value="営業部">営業部</option>
414
-
415
- <option value="役員">役員</option>
416
-
417
-
418
-
419
- </select>
420
-
421
- </td>
422
-
423
- </tr>
424
-
425
-
426
-
427
- <tr>
428
-
429
- <th>役職</th>
430
-
431
- <td><span id="label5"></span>
432
-
433
- <select name="title">
434
-
435
- <option value="">選択してください</option>
436
-
437
- <option value="CEO">CEO</option>
438
-
439
- <option value="COO">COO</option>
440
-
441
- <option value="CTO">CTO</option>
442
-
443
- <option value="部長">部長</option>
444
-
445
- <option value="係長">係長</option>
446
-
447
- <option value="主任">主任</option>
448
-
449
-
450
-
451
- </select>
452
-
453
- </td>
454
-
455
- </tr>
456
-
457
- </table>
458
-
459
- </div>
460
-
461
-   <input type="button" name="btn" value="確認" onClick="fncDisp(), shwSelect()">
462
-
463
- </form>
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
- <form id="search" action="search" method="POST">
472
-
473
-
474
-
475
- <input type="hidden" id="label1" type="text" />
476
-
477
- <input type="hidden" id="label2" type="text" />
478
-
479
- <input type="hidden" id="label3" type="text" />
480
-
481
- <input type="hidden" id="label4" type="text" />
482
-
483
- <input type="hidden" id="label5" type="text" />
484
-
485
- <input class="btn btn-success center-block" value="検索" onClick="FormSubmit();" />
486
-
487
-
488
-
489
-
490
-
491
- </form>
492
-
493
- <br />
494
-
495
- ```

3

修正しました。

2018/06/21 04:29

投稿

javabeginar
javabeginar

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,7 +1,237 @@
1
- ```html javascript
1
+ ```html/javascript
2
2
 
3
3
  コード
4
4
 
5
+
6
+
7
+ <!DOCTYPE html>
8
+
9
+ <html>
10
+
11
+ <head>
12
+
13
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
14
+
15
+ <jsp:include page="header1.jsp" />
16
+
17
+ <Script>
18
+
19
+ <!--
20
+
21
+ function fncDisp()
22
+
23
+ {
24
+
25
+ label1.innerHTML = document.f.nam.value;
26
+
27
+ label2.innerHTML = document.f.namae.value;
28
+
29
+ label3.innerHTML = document.f.mail.value;
30
+
31
+ }
32
+
33
+ function shwSelect()
34
+
35
+ {
36
+
37
+ //セレクトボックスの値(数値)を取得
38
+
39
+ var num = document.f.depart.selectedIndex;
40
+
41
+ // 値(value値)を取得
42
+
43
+ var str = document.f.depart.options[num].value;
44
+
45
+ document.getElementById("label4").innerHTML = str;
46
+
47
+
48
+
49
+ //セレクトボックスの値(数値)を取得
50
+
51
+ var num = document.f.title.selectedIndex;
52
+
53
+ // 値(value値)を取得
54
+
55
+ var str = document.f.title.options[num].value;
56
+
57
+ document.getElementById("label5").innerHTML = str;
58
+
59
+ }
60
+
61
+ function FormSubmit() {
62
+
63
+ var target = document.getElementById("search");
64
+
65
+ document.getElementsByName("nam")[0].value = document.getElementsByName("nam")[0].value
66
+
67
+ document.getElementsByName("namae")[0].value = document.getElementsByName("namae")[0].value
68
+
69
+ document.getElementsByName("mail")[0].value = document.getElementsByName("mail")[0].value
70
+
71
+ document.getElementsByName("depart")[0].value = document.getElementsByName("depart")[0].value
72
+
73
+ document.getElementsByName("title")[0].value = document.getElementsByName("title")[0].value
74
+
75
+ target.method = "post";
76
+
77
+ target.submit();
78
+
79
+ }
80
+
81
+ -->
82
+
83
+ </Script>
84
+
85
+
86
+
87
+ <title>管理システム</title>
88
+
89
+ </head>
90
+
91
+ <body>
92
+
93
+ <jsp:include page="nav1.jsp" />
94
+
95
+ <form name="f" action="">
96
+
97
+ <div class="containers">
98
+
99
+ <table class="table">
100
+
101
+ <tr>
102
+
103
+ <th>従業員名</th>
104
+
105
+ <td>
106
+
107
+ <span id="label1"></span>
108
+
109
+ <input type="text" name="nam" value="<c:out value="${dto.nam}" />" maxlength="128" size="60"/></td>
110
+
111
+ </tr>
112
+
113
+ <tr>
114
+
115
+ <th>従業員名(フリガナ)</th>
116
+
117
+ <td>
118
+
119
+ <span id="label2"></span>
120
+
121
+ <input type="text" name="namae" value="<c:out value="${dto.namae}" />" maxlength="128" size="60"/></td>
122
+
123
+ </tr>
124
+
125
+ <tr>
126
+
127
+ <th>メールアドレス</th>
128
+
129
+ <td><span id="label3"></span>
130
+
131
+ <input type="text" name="mail" value="<c:out value="${dto.mail}" />" maxlength="128" size="60"/></td>
132
+
133
+ </tr>
134
+
135
+ <tr>
136
+
137
+ <th>部署</th>
138
+
139
+ <td><span id="label4"></span>
140
+
141
+ <select name="depart">
142
+
143
+ <option value="">選択してください</option>
144
+
145
+ <option value="システム事業部">システム事業部</option>
146
+
147
+ <option value="活用事業部">活用事業部</option>
148
+
149
+ <option value="営業部">営業部</option>
150
+
151
+ <option value="役員">役員</option>
152
+
153
+
154
+
155
+ </select>
156
+
157
+ </td>
158
+
159
+ </tr>
160
+
161
+
162
+
163
+ <tr>
164
+
165
+ <th>役職</th>
166
+
167
+ <td><span id="label5"></span>
168
+
169
+ <select name="title">
170
+
171
+ <option value="">選択してください</option>
172
+
173
+ <option value="CEO">CEO</option>
174
+
175
+ <option value="COO">COO</option>
176
+
177
+ <option value="CTO">CTO</option>
178
+
179
+ <option value="部長">部長</option>
180
+
181
+ <option value="係長">係長</option>
182
+
183
+ <option value="主任">主任</option>
184
+
185
+
186
+
187
+ </select>
188
+
189
+ </td>
190
+
191
+ </tr>
192
+
193
+ </table>
194
+
195
+ </div>
196
+
197
+   <input type="button" name="btn" value="確認" onClick="fncDisp(), shwSelect()">
198
+
199
+ </form>
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+ <form id="search" action="search" method="POST">
208
+
209
+
210
+
211
+ <input type="hidden" id="label1" type="text" />
212
+
213
+ <input type="hidden" id="label2" type="text" />
214
+
215
+ <input type="hidden" id="label3" type="text" />
216
+
217
+ <input type="hidden" id="label4" type="text" />
218
+
219
+ <input type="hidden" id="label5" type="text" />
220
+
221
+ <input class="btn btn-success center-block" value="検索" onClick="FormSubmit();" />
222
+
223
+
224
+
225
+
226
+
227
+ </form>
228
+
229
+ <br />
230
+
231
+ ```
232
+
233
+
234
+
5
235
  ```ツール:Eclipse
6
236
 
7
237
 

2

修正しました。

2018/06/21 04:18

投稿

javabeginar
javabeginar

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,8 @@
1
+ ```html javascript
2
+
3
+ コード
4
+
1
- ツール:Eclipse
5
+ ```ツール:Eclipse
2
6
 
3
7
 
4
8
 

1

コードを見やすくしました。

2018/06/21 04:16

投稿

javabeginar
javabeginar

スコア13

test CHANGED
File without changes
test CHANGED
@@ -257,3 +257,5 @@
257
257
  </form>
258
258
 
259
259
  <br />
260
+
261
+ ```