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