質問編集履歴
3
実現したいことを更新しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
|
15
15
|
上記を実現する際、localStorageが使用できないため、localStorageを使用する以外の代替案を教えて下さい。
|
16
16
|
|
17
|
+
sales_order.htmlで入力した値に応じて、order_result.htmlに結果を出力する機能を実現したいです。
|
18
|
+
|
17
19
|
|
18
20
|
|
19
21
|
|
2
結果を表示するhtml及び試したことを更新。
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,193 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
-
|
25
|
+
sales_order.html
|
26
|
+
|
27
|
+
```<!DOCTYPE html>
|
28
|
+
|
29
|
+
<html lang=“ja”>
|
30
|
+
|
31
|
+
<head>
|
32
|
+
|
33
|
+
<meta http-equiv="content-language" content="ja">
|
34
|
+
|
35
|
+
<meta name="robots" content="noindex,nofollow">
|
36
|
+
|
37
|
+
<meta charset="UTF-8">
|
38
|
+
|
39
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
40
|
+
|
41
|
+
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css">
|
42
|
+
|
43
|
+
<link rel="stylesheet" type="text/css" href="css/style.css">
|
44
|
+
|
45
|
+
<title>受注確認画面</title>
|
46
|
+
|
47
|
+
</head>
|
48
|
+
|
49
|
+
<body>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
<script>
|
54
|
+
|
55
|
+
var storage = localStorage;
|
56
|
+
|
57
|
+
storage.setItem("clientID", " ");
|
58
|
+
|
59
|
+
storage.setItem("testd1", " ");
|
60
|
+
|
61
|
+
//省略
|
62
|
+
|
63
|
+
function orderkaki(){
|
64
|
+
|
65
|
+
if (!window.localStorage){
|
66
|
+
|
67
|
+
alert("お使いのブラウザはlocalstorageに対応してません。");
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
var storage = localStorage;
|
72
|
+
|
73
|
+
storage.setItem("clientID", document.form2.s.value);
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
if(document.form2.s.value == ""){
|
78
|
+
|
79
|
+
alert("顧客IDが未入力です!");
|
80
|
+
|
81
|
+
storage.setItem("clientID", " ");
|
82
|
+
|
83
|
+
storage.setItem("testd1", " ");
|
84
|
+
|
85
|
+
//省略
|
86
|
+
|
87
|
+
document.form2.action = './sales_order.html';
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
if((document.form2.s.value != "")&&(document.form2.s.value != "123456789")&&(document.form2.s.value != "111111111")&&(document.form2.s.value != "222222222")&&(document.form2.s.value != "333333333")){
|
94
|
+
|
95
|
+
alert("顧客IDが存在しません。");
|
96
|
+
|
97
|
+
storage.setItem("testd1", " ");
|
98
|
+
|
99
|
+
//省略
|
100
|
+
|
101
|
+
document.form2.action = './sales_order.html';
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
if(document.form2.s.value == "123456789"){
|
108
|
+
|
109
|
+
storage.setItem("testd1", "2019/08/03");
|
110
|
+
|
111
|
+
storage.setItem("testd2", "2019/07/09");
|
112
|
+
|
113
|
+
storage.setItem("testd3", "2019/07/01");
|
114
|
+
|
115
|
+
storage.setItem("testd4", "2019/07/01");
|
116
|
+
|
117
|
+
storage.setItem("testd5", "2019/06/20");
|
118
|
+
|
119
|
+
storage.setItem("testc1", "A001");
|
120
|
+
|
121
|
+
storage.setItem("testc2", "C001");
|
122
|
+
|
123
|
+
storage.setItem("testc3", "D001");
|
124
|
+
|
125
|
+
storage.setItem("testc4", "B001");
|
126
|
+
|
127
|
+
storage.setItem("testc5", "E001");
|
128
|
+
|
129
|
+
storage.setItem("testn1", "42");
|
130
|
+
|
131
|
+
storage.setItem("testn2", "21");
|
132
|
+
|
133
|
+
storage.setItem("testn3", "76");
|
134
|
+
|
135
|
+
storage.setItem("testn4", "21");
|
136
|
+
|
137
|
+
storage.setItem("testn5", "100");
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
//省略
|
144
|
+
|
145
|
+
</script>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<main class="confirmation">
|
150
|
+
|
151
|
+
<h1>受注確認画面</h1>
|
152
|
+
|
153
|
+
<div class="wrapper content clearfix">
|
154
|
+
|
155
|
+
<div class="left">
|
156
|
+
|
157
|
+
<ul class="leftBox">
|
158
|
+
|
159
|
+
<li class="menu"><a href="./main.html"><p>Menu</p></a></li>
|
160
|
+
|
161
|
+
<li class="order"><a href="./order_entry.html"><p>受注入力</p></a></li>
|
162
|
+
|
163
|
+
<li class="confirmation"><a href="./sales_order.html"><p>受注確認</p></a></li>
|
164
|
+
|
165
|
+
<li class="stock"><a href="./inventory_control.html"><p>在庫管理</p></a></li>
|
166
|
+
|
167
|
+
</ul>
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="right">
|
172
|
+
|
173
|
+
<form id="form1" action="order_result.html" method="post" name="form2" onsubmit="orderkaki()">
|
174
|
+
|
175
|
+
<table class="mt20">
|
176
|
+
|
177
|
+
<tr>
|
178
|
+
|
179
|
+
<th><p class="productCode">顧客ID</p></th>
|
180
|
+
|
181
|
+
<td>
|
182
|
+
|
183
|
+
<input id="sbox" id="s" name="s" type="text" placeholder="IDを入力" />
|
184
|
+
|
185
|
+
</td>
|
186
|
+
|
187
|
+
</tr>
|
188
|
+
|
189
|
+
</table>
|
190
|
+
|
191
|
+
<input id="sbtn" class="button mt30" type="submit" value="検索" />
|
192
|
+
|
193
|
+
</form>
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
</main>
|
200
|
+
|
201
|
+
</body>
|
202
|
+
|
203
|
+
</html>
|
204
|
+
|
205
|
+
```
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
order_result.html
|
210
|
+
|
211
|
+
```
|
26
212
|
|
27
213
|
<!DOCTYPE html>
|
28
214
|
|
@@ -42,7 +228,23 @@
|
|
42
228
|
|
43
229
|
<link rel="stylesheet" type="text/css" href="css/style.css">
|
44
230
|
|
45
|
-
<title>受注確認画面</title>
|
231
|
+
<title>受注確認結果画面</title>
|
232
|
+
|
233
|
+
<style>
|
234
|
+
|
235
|
+
#table table {
|
236
|
+
|
237
|
+
width: 100%;
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
#table table th {
|
242
|
+
|
243
|
+
background: #ccc;
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
</style>
|
46
248
|
|
47
249
|
</head>
|
48
250
|
|
@@ -50,105 +252,137 @@
|
|
50
252
|
|
51
253
|
|
52
254
|
|
53
|
-
<script>
|
255
|
+
<script type="text/javascript">
|
54
256
|
|
55
257
|
var storage = localStorage;
|
56
258
|
|
57
|
-
storage.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
259
|
+
var cclientID = storage.getItem("clientID");
|
260
|
+
|
261
|
+
var ctestd1 = storage.getItem("testd1");
|
262
|
+
|
263
|
+
var ctestd2 = storage.getItem("testd2");
|
264
|
+
|
265
|
+
var ctestd3 = storage.getItem("testd3");
|
266
|
+
|
267
|
+
var ctestd4 = storage.getItem("testd4");
|
268
|
+
|
269
|
+
var ctestd5 = storage.getItem("testd5");
|
270
|
+
|
271
|
+
var ctestc1 = storage.getItem("testc1");
|
272
|
+
|
273
|
+
var ctestc2 = storage.getItem("testc2");
|
274
|
+
|
275
|
+
var ctestc3 = storage.getItem("testc3");
|
276
|
+
|
277
|
+
var ctestc4 = storage.getItem("testc4");
|
278
|
+
|
279
|
+
var ctestc5 = storage.getItem("testc5");
|
280
|
+
|
281
|
+
var ctestn1 = storage.getItem("testn1");
|
282
|
+
|
283
|
+
var ctestn2 = storage.getItem("testn2");
|
284
|
+
|
285
|
+
var ctestn3 = storage.getItem("testn3");
|
286
|
+
|
287
|
+
var ctestn4 = storage.getItem("testn4");
|
288
|
+
|
289
|
+
var ctestn5 = storage.getItem("testn5");
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
// 表の動的作成
|
298
|
+
|
299
|
+
function makeTable(data, tableId){
|
300
|
+
|
301
|
+
// 表の作成開始
|
302
|
+
|
303
|
+
var rows=[];
|
304
|
+
|
305
|
+
var table = document.createElement("table");
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
// 表に2次元配列の要素を格納
|
310
|
+
|
311
|
+
for(i = 0; i < data.length; i++){
|
312
|
+
|
313
|
+
rows.push(table.insertRow(-1)); // 行の追加
|
314
|
+
|
315
|
+
for(j = 0; j < data[0].length; j++){
|
316
|
+
|
317
|
+
cell=rows[i].insertCell(-1);
|
318
|
+
|
319
|
+
cell.appendChild(document.createTextNode(data[i][j]));
|
320
|
+
|
321
|
+
// 背景色の設定
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
// 指定したdiv要素に表を加える
|
328
|
+
|
329
|
+
document.getElementById(tableId).appendChild(table);
|
330
|
+
|
331
|
+
}
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
window.onload = function(){
|
338
|
+
|
339
|
+
var data;
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
if(cclientID == "123456789") {
|
344
|
+
|
345
|
+
data = [
|
346
|
+
|
347
|
+
["発注日", "商品コード", "発注数"],
|
348
|
+
|
349
|
+
[ctestd1, ctestc1, ctestn1],
|
350
|
+
|
351
|
+
[ctestd2, ctestc2, ctestn2],
|
352
|
+
|
353
|
+
[ctestd3, ctestc3, ctestn3],
|
354
|
+
|
355
|
+
[ctestd4, ctestc4, ctestn4],
|
356
|
+
|
357
|
+
[ctestd5, ctestc5, ctestn5]
|
358
|
+
|
359
|
+
];
|
360
|
+
|
361
|
+
}
|
362
|
+
|
363
|
+
//省略
|
364
|
+
|
365
|
+
} else {
|
366
|
+
|
367
|
+
data = [];
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
// 表の動的作成
|
374
|
+
|
375
|
+
makeTable(data,"table");
|
376
|
+
|
377
|
+
};
|
378
|
+
|
379
|
+
|
144
380
|
|
145
381
|
</script>
|
146
382
|
|
147
|
-
|
148
|
-
|
149
383
|
<main class="confirmation">
|
150
384
|
|
151
|
-
<h1>受注確認画面</h1>
|
385
|
+
<h1>受注確認結果画面</h1>
|
152
386
|
|
153
387
|
<div class="wrapper content clearfix">
|
154
388
|
|
@@ -170,28 +404,30 @@
|
|
170
404
|
|
171
405
|
<div class="right">
|
172
406
|
|
173
|
-
<form id="form1" action="order_result.html"
|
407
|
+
<form id="form1" action="./order_result.html">
|
174
|
-
|
408
|
+
|
175
|
-
<table class="
|
409
|
+
<table class="result">
|
176
410
|
|
177
411
|
<tr>
|
178
412
|
|
179
|
-
<th
|
413
|
+
<th class="productCode">顧客ID</th>
|
180
|
-
|
181
|
-
|
414
|
+
|
182
|
-
|
183
|
-
|
415
|
+
<td><script>document.write(cclientID)</script></td>
|
184
|
-
|
185
|
-
</td>
|
186
416
|
|
187
417
|
</tr>
|
188
418
|
|
189
419
|
</table>
|
190
420
|
|
191
|
-
<input id="sbtn" class="button mt
|
421
|
+
<input id="sbtn" class="button mt15 mb15" type="submit" value="検索" />
|
192
422
|
|
193
423
|
</form>
|
194
424
|
|
425
|
+
|
426
|
+
|
427
|
+
<div id="table" class="result"></div>
|
428
|
+
|
429
|
+
|
430
|
+
|
195
431
|
</div>
|
196
432
|
|
197
433
|
</div>
|
@@ -202,6 +438,8 @@
|
|
202
438
|
|
203
439
|
</html>
|
204
440
|
|
441
|
+
|
442
|
+
|
205
443
|
```
|
206
444
|
|
207
445
|
|
@@ -220,6 +458,12 @@
|
|
220
458
|
|
221
459
|
|
222
460
|
|
461
|
+
・cokkieでもダメでした。
|
462
|
+
|
463
|
+
https://teratail.com/questions/101774
|
464
|
+
|
465
|
+
|
466
|
+
|
223
|
-
##
|
467
|
+
## 補足情報
|
224
468
|
|
225
469
|
・OS:Win10
|
1
前提と補足情報を追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
条件としては、フロント側だけでデータの処理をするので、JavaScriptのlocalStorageを用いて、データの管理を行っています。
|
8
8
|
|
9
|
-
実行環境は、ブラウザIE11でローカル環境です。
|
9
|
+
実行環境は、ブラウザIE11でローカル環境です。(実行環境は変更不可です。)
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -217,3 +217,9 @@
|
|
217
217
|
|
218
218
|
|
219
219
|
・sessionStorageも同様に使用できなかった。(WebStorageのため)
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
### 補足情報
|
224
|
+
|
225
|
+
・OS:Win10
|