質問編集履歴
1
タイトル設定、PG言語入力、コード入力をしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
ホームページ上のフォームに数字を入れると、
|
1
|
+
###ホームページ上のフォームに数字を入れると、
|
2
2
|
|
3
3
|
計算結果と表示されるようにし、1つの図に折れ線グラフで
|
4
4
|
|
@@ -57,3 +57,523 @@
|
|
57
57
|
プログラミングに疎いもので、大変ワガママなお話で恐縮ですが、
|
58
58
|
|
59
59
|
ご教示いただけますと幸いです。
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
```JavaScript
|
64
|
+
|
65
|
+
コード
|
66
|
+
|
67
|
+
```
|
68
|
+
|
69
|
+
<!doctype html>
|
70
|
+
|
71
|
+
<html>
|
72
|
+
|
73
|
+
<head>
|
74
|
+
|
75
|
+
<!-- Global site tag (gtag.js) - Google Analytics -->
|
76
|
+
|
77
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-138256867-1"></script>
|
78
|
+
|
79
|
+
<script>
|
80
|
+
|
81
|
+
window.dataLayer = window.dataLayer || [];
|
82
|
+
|
83
|
+
function gtag(){dataLayer.push(arguments);}
|
84
|
+
|
85
|
+
gtag('js', new Date());
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
gtag('config', 'UA-138256867-1');
|
90
|
+
|
91
|
+
</script>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<meta charset="utf-8">
|
96
|
+
|
97
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
98
|
+
|
99
|
+
<link rel="stylesheet" href="css/reset.css">
|
100
|
+
|
101
|
+
<link rel="stylesheet" href="css/style.css">
|
102
|
+
|
103
|
+
</style>
|
104
|
+
|
105
|
+
<script>
|
106
|
+
|
107
|
+
function sample() {
|
108
|
+
|
109
|
+
window.scrollTo(0,50);
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
</script>
|
114
|
+
|
115
|
+
</head>
|
116
|
+
|
117
|
+
<BODY >
|
118
|
+
|
119
|
+
<DIV class="container">
|
120
|
+
|
121
|
+
<DIV id="header">
|
122
|
+
|
123
|
+
<DIV id="header_bk">
|
124
|
+
|
125
|
+
<DIV id="header_top">
|
126
|
+
|
127
|
+
</DIV>
|
128
|
+
|
129
|
+
</DIV>
|
130
|
+
|
131
|
+
<section id="catMenu">
|
132
|
+
|
133
|
+
<ul class="flex">
|
134
|
+
|
135
|
+
<li class="btn"><a href="index.html">Infomation</a></li>
|
136
|
+
|
137
|
+
<li class="btn"><a href="simulation.html">Simulation</a></li>
|
138
|
+
|
139
|
+
<li class="btn"><a href="question.html">Question</a></li>
|
140
|
+
|
141
|
+
<li class="btn"></li>
|
142
|
+
|
143
|
+
</ul>
|
144
|
+
|
145
|
+
</section>
|
146
|
+
|
147
|
+
<section id="catBtnsSection">
|
148
|
+
|
149
|
+
<div class="flex between cate">
|
150
|
+
|
151
|
+
<div><a href="index.html"><img src="images/infomation.png" alt=""></a></div>
|
152
|
+
|
153
|
+
<div><a href="simulation.html"><img src="images/simulation.png" alt=""></a></div>
|
154
|
+
|
155
|
+
<div><a href="question.html"><img src="images/question.png" alt=""></a></div>
|
156
|
+
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</section>
|
160
|
+
|
161
|
+
</DIV>
|
162
|
+
|
163
|
+
<div class="wrap">
|
164
|
+
|
165
|
+
<DIV class="contents">
|
166
|
+
|
167
|
+
<section class="conTabel">
|
168
|
+
|
169
|
+
<form>
|
170
|
+
|
171
|
+
<h2>Simulation</h2>
|
172
|
+
|
173
|
+
<p class="descr">※元金と期間を入力すると下の表に未来の予測金額をシミュレートします。</p>
|
174
|
+
|
175
|
+
<p><label for="textForm">元金 : </label>
|
176
|
+
|
177
|
+
<input type="text" id="textForm"><label for="textForm"> ドル </label></p>
|
178
|
+
|
179
|
+
<p><label for="textForm2">期間 : </label>
|
180
|
+
|
181
|
+
<input type="text" id="textForm2"><label for="textForm2"> 年後</label></p>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
<div class="buttonWrap"><button id="button">シミュレートする</button></div>
|
186
|
+
|
187
|
+
</form>
|
188
|
+
|
189
|
+
<div class="tableWrap">
|
190
|
+
|
191
|
+
<table>
|
192
|
+
|
193
|
+
<tr>
|
194
|
+
|
195
|
+
<th>種目</th>
|
196
|
+
|
197
|
+
<th>銀行</th>
|
198
|
+
|
199
|
+
<th class="tablePoint">商品A</th>
|
200
|
+
|
201
|
+
<th>仮想通貨</th>
|
202
|
+
|
203
|
+
<th>FX</th>
|
204
|
+
|
205
|
+
<th>不動産</th>
|
206
|
+
|
207
|
+
</tr>
|
208
|
+
|
209
|
+
<tr>
|
210
|
+
|
211
|
+
<td align="right" nowrap>保証</td>
|
212
|
+
|
213
|
+
<td valign="top">○</td>
|
214
|
+
|
215
|
+
<td class="tablePoint" valign="top" >○</td>
|
216
|
+
|
217
|
+
<td valign="top" >×</td>
|
218
|
+
|
219
|
+
<td valign="top" >×</td>
|
220
|
+
|
221
|
+
<td valign="top" >△</td>
|
222
|
+
|
223
|
+
</tr>
|
224
|
+
|
225
|
+
<tr>
|
226
|
+
|
227
|
+
<td bgcolor="#99CC00" align="right" nowrap>利率</td>
|
228
|
+
|
229
|
+
<td valign="top">0.01%</td>
|
230
|
+
|
231
|
+
<td class="tablePoint" valign="top" >250%</td>
|
232
|
+
|
233
|
+
<td valign="top" >15% - 876%</td>
|
234
|
+
|
235
|
+
<td valign="top" >50%</td>
|
236
|
+
|
237
|
+
<td valign="top" >105%</td>
|
238
|
+
|
239
|
+
</tr>
|
240
|
+
|
241
|
+
<tr>
|
242
|
+
|
243
|
+
<td id="resultForm0" bgcolor="#99CC00" align="right" nowrap>年月</td>
|
244
|
+
|
245
|
+
<td id="resultForm1" valign="top">ドル</td>
|
246
|
+
|
247
|
+
<td class="tablePoint" id="resultForm2" valign="top" >ドル</td>
|
248
|
+
|
249
|
+
<td id="resultForm3" valign="top" >ドル</td>
|
250
|
+
|
251
|
+
<td id="resultForm4" valign="top" >ドル</td>
|
252
|
+
|
253
|
+
<td id="resultForm5" valign="top" >ドル</td>
|
254
|
+
|
255
|
+
</tr>
|
256
|
+
|
257
|
+
<tr>
|
258
|
+
|
259
|
+
<td bgcolor="#99CC00" align="right" nowrap>サービス</td>
|
260
|
+
|
261
|
+
<td valign="top">-</td>
|
262
|
+
|
263
|
+
<td valign="top" >-</td>
|
264
|
+
|
265
|
+
<td valign="top" >-</td>
|
266
|
+
|
267
|
+
<td valign="top" >-</td>
|
268
|
+
|
269
|
+
</tr>
|
270
|
+
|
271
|
+
<tr>
|
272
|
+
|
273
|
+
<td bgcolor="#99CC00" align="right" nowrap>詳細・特徴・将来性</td>
|
274
|
+
|
275
|
+
<td valign="top"><a href="https://www.jp-bank.japanpost.jp/kojin/chokin/tujo/kj_cho_tj_index.html" rel="noreferrer">郵貯HPへ</a></td>
|
276
|
+
|
277
|
+
<td valign="top" >-</td>
|
278
|
+
|
279
|
+
<td valign="top" >-</td>
|
280
|
+
|
281
|
+
<td valign="top" >-</td>
|
282
|
+
|
283
|
+
</tr>
|
284
|
+
|
285
|
+
</table>
|
286
|
+
|
287
|
+
</div>
|
288
|
+
|
289
|
+
</section>
|
290
|
+
|
291
|
+
</DIV>
|
292
|
+
|
293
|
+
</div>
|
294
|
+
|
295
|
+
<FOOTER id="footer_notfix_gray_login">
|
296
|
+
|
297
|
+
<div class="footerWrap"></div>
|
298
|
+
|
299
|
+
<DIV class="upper" onclick="sample()">^ </DIV>
|
300
|
+
|
301
|
+
<div class="fotterFont">
|
302
|
+
|
303
|
+
<ADDRESS class="footer_copy">
|
304
|
+
|
305
|
+
※掲載されている情報は、投資判断の参考として投資一般に関する情報提供を目的とするものであり、投資の最終決定はご自身の判断でなさるようにお願いいたします。
|
306
|
+
|
307
|
+
</ADDRESS>
|
308
|
+
|
309
|
+
<ADDRESS class="footer_copy">
|
310
|
+
|
311
|
+
</ADDRESS>
|
312
|
+
|
313
|
+
<div class="pcflex">
|
314
|
+
|
315
|
+
<!--<TABLE class="ftabele">
|
316
|
+
|
317
|
+
<TBODY>
|
318
|
+
|
319
|
+
<TR>
|
320
|
+
|
321
|
+
<TD><IMG class="footerlink_icon" src="images/arrow_small.png"></TD>
|
322
|
+
|
323
|
+
<TD><A class="footerlink_link" href="poricy.html">poricy</A></TD>
|
324
|
+
|
325
|
+
</TR>
|
326
|
+
|
327
|
+
</TBODY>
|
328
|
+
|
329
|
+
</TABLE>
|
330
|
+
|
331
|
+
<TABLE class="ftabele">
|
332
|
+
|
333
|
+
<TBODY>
|
334
|
+
|
335
|
+
<TR>
|
336
|
+
|
337
|
+
<TD><IMG class="footerlink_icon" src="images/arrow_small.png"></TD>
|
338
|
+
|
339
|
+
<TD><A class="footerlink_link" href="toc.html">Terms of Service</A></TD>
|
340
|
+
|
341
|
+
</TR>
|
342
|
+
|
343
|
+
</TBODY>
|
344
|
+
|
345
|
+
</TABLE>-->
|
346
|
+
|
347
|
+
</div>
|
348
|
+
|
349
|
+
</div>
|
350
|
+
|
351
|
+
</div>
|
352
|
+
|
353
|
+
</FOOTER>
|
354
|
+
|
355
|
+
</BODY>
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
<script>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
// ボタンの要素を取得
|
366
|
+
|
367
|
+
var button = document.getElementById("button");
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
// ボタンをクリックした時の処理
|
372
|
+
|
373
|
+
button.addEventListener("click", function(e) {
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
e.preventDefault();
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
// 入力フォームの値を取得
|
382
|
+
|
383
|
+
var textForm = document.getElementById("textForm").value;
|
384
|
+
|
385
|
+
var textForm2 = document.getElementById("textForm2").value;
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
//全角数字を半角数字に変換(textForm)
|
390
|
+
|
391
|
+
var before = new Array("1","2","3","4","5","6","7","8","9","0");
|
392
|
+
|
393
|
+
var after=new Array("1","2","3","4","5","6","7","8","9","0");
|
394
|
+
|
395
|
+
var val = textForm;
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
var bef = before;
|
400
|
+
|
401
|
+
var aft = after;
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
for (i = 0; i < aft.length; i++) {
|
406
|
+
|
407
|
+
reg = new RegExp(bef[i], "g");
|
408
|
+
|
409
|
+
val = val.replace(reg, aft[i]);
|
410
|
+
|
411
|
+
}
|
412
|
+
|
413
|
+
textForm=Number(val);
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
//全角数字を半角数字に変換(textForm2)
|
418
|
+
|
419
|
+
var before = new Array("1","2","3","4","5","6","7","8","9","0");
|
420
|
+
|
421
|
+
var after=new Array("1","2","3","4","5","6","7","8","9","0");
|
422
|
+
|
423
|
+
var val = textForm2;
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
var bef = before;
|
428
|
+
|
429
|
+
var aft = after;
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
for (i = 0; i < aft.length; i++) {
|
434
|
+
|
435
|
+
reg = new RegExp(bef[i], "g");
|
436
|
+
|
437
|
+
val = val.replace(reg, aft[i]);
|
438
|
+
|
439
|
+
}
|
440
|
+
|
441
|
+
textForm2=Number(val);
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
// 取得した値を別の表に表示
|
448
|
+
|
449
|
+
document.getElementById("resultForm0").innerText = textForm2+"年後";
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
// 取得した値を別の表に表示
|
454
|
+
|
455
|
+
var result = textForm*(1.0001**textForm2);
|
456
|
+
|
457
|
+
// 数字を丸く
|
458
|
+
|
459
|
+
result = result*100;
|
460
|
+
|
461
|
+
result = Math.round(result);
|
462
|
+
|
463
|
+
result = result/100;
|
464
|
+
|
465
|
+
// 3桁ごとにカンマ
|
466
|
+
|
467
|
+
var num = new String( result );
|
468
|
+
|
469
|
+
while( num != ( num = num.replace( /(\d)((\d\d\d)+\b)/, '$1,$2' ) ) );
|
470
|
+
|
471
|
+
result = num;
|
472
|
+
|
473
|
+
document.getElementById("resultForm1").innerText = result+"ドル";
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
// 取得した値を別の表に表示
|
478
|
+
|
479
|
+
result = textForm*(2.5**textForm2);
|
480
|
+
|
481
|
+
result = result*100;
|
482
|
+
|
483
|
+
result = Math.round(result);
|
484
|
+
|
485
|
+
result = result/100;
|
486
|
+
|
487
|
+
num = new String( result );
|
488
|
+
|
489
|
+
while( num != ( num = num.replace( /(\d)((\d\d\d)+\b)/, '$1,$2' ) ) );
|
490
|
+
|
491
|
+
result = num;
|
492
|
+
|
493
|
+
document.getElementById("resultForm2").innerText = result+"ドル";
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
// 取得した値を別の表に表示
|
498
|
+
|
499
|
+
result = textForm*(0.015**textForm2);
|
500
|
+
|
501
|
+
result = result*100;
|
502
|
+
|
503
|
+
result = Math.round(result);
|
504
|
+
|
505
|
+
result = result/100;
|
506
|
+
|
507
|
+
num = new String( result );
|
508
|
+
|
509
|
+
while( num != ( num = num.replace( /(\d)((\d\d\d)+\b)/, '$1,$2' ) ) );
|
510
|
+
|
511
|
+
result = num;
|
512
|
+
|
513
|
+
var result2 = textForm*(8.76**textForm2);
|
514
|
+
|
515
|
+
result2 = result2*100;
|
516
|
+
|
517
|
+
result2 = Math.round(result2);
|
518
|
+
|
519
|
+
result2 = result2/100;
|
520
|
+
|
521
|
+
num = new String( result2 );
|
522
|
+
|
523
|
+
while( num != ( num = num.replace( /(\d)((\d\d\d)+\b)/, '$1,$2' ) ) );
|
524
|
+
|
525
|
+
result2 = num;
|
526
|
+
|
527
|
+
document.getElementById("resultForm3").innerText = result+"ドル - "+result2+"ドル";
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
// 取得した値を別の表に表示
|
532
|
+
|
533
|
+
result = textForm*(0.5**textForm2);
|
534
|
+
|
535
|
+
result = result*100;
|
536
|
+
|
537
|
+
result = Math.round(result);
|
538
|
+
|
539
|
+
result = result/100;
|
540
|
+
|
541
|
+
num = new String( result );
|
542
|
+
|
543
|
+
while( num != ( num = num.replace( /(\d)((\d\d\d)+\b)/, '$1,$2' ) ) );
|
544
|
+
|
545
|
+
result = num;
|
546
|
+
|
547
|
+
document.getElementById("resultForm4").innerText = result+"ドル";
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
// 取得した値を別の表に表示
|
552
|
+
|
553
|
+
result = textForm*(1.05**textForm2);
|
554
|
+
|
555
|
+
result = result*100;
|
556
|
+
|
557
|
+
result = Math.round(result);
|
558
|
+
|
559
|
+
result = result/100;
|
560
|
+
|
561
|
+
num = new String( result );
|
562
|
+
|
563
|
+
while( num != ( num = num.replace( /(\d)((\d\d\d)+\b)/, '$1,$2' ) ) );
|
564
|
+
|
565
|
+
result = num;
|
566
|
+
|
567
|
+
document.getElementById("resultForm5").innerText = result+"ドル";
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
});
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
</script>
|
578
|
+
|
579
|
+
</html>
|