第15週HTML+CSS+JavaScript+Word轉pdf
利率y(rate) | 期數n(nper) | 金流m(pmt) | 終值f(fv) |
參考劉任昌金融市場講義
陳韋翔學習HTML+CSS+JavaScript程式碼
<style>
h1{border: 30px outset red;
background-color: green;
color: white;
text-align: center;}
</style>
<script>
function computePV(){
var r = document.getElementById("rate").value;
var n = document.getElementById("nper").value;
var m = document.getElementById("pmt").value;
var f = document.getElementById("fv").value;
pvif =r;
pvif++;
pvif =1/pvif**n;
var pv = (1-pvif)*m/r + f * pvif;
document.getElementById("pv").innerHTML = pv;
}
</script>
<body>
<table border="1">
<tr><td>利率y(rate)</td><td>期數n(nper)</td><td>金流m(pmt)</td><td>終值f(fv)</td></tr>
<td><input id="rate" type="number" /></td>
<td><input id="nper" type="number" /></td>
<td><input id="pmt" type="number" /></td>
<td><input id="fv" type="number" /></td></table></body>
<input onclick="computePV()" type="button" value="計算現值" /><div><div style="text-align: center;"><span style="font-family: Arial;"><span style="font-size: 13.3333px; white-space: pre;"><br /></span></span></div><div style="text-align: center;"><span style="font-family: Arial;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzv40tQLDh5qoxidNxQNd3AcvkZWUgVH-Y2EKbS4w0SlwfQB6uP6DWPo0G2zy2sQqCDlh-wvJ_EMeevXszcAZ9nDHJ_5fROftfk0ichxIkjgZ4RxP0Xla3wYwik68bw0csg7payyB5cMg/s285/12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="55" data-original-width="285" height="97" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzv40tQLDh5qoxidNxQNd3AcvkZWUgVH-Y2EKbS4w0SlwfQB6uP6DWPo0G2zy2sQqCDlh-wvJ_EMeevXszcAZ9nDHJ_5fROftfk0ichxIkjgZ4RxP0Xla3wYwik68bw0csg7payyB5cMg/w504-h97/12.JPG" width="504" /></a></div><br /><span style="font-size: 13.3333px; white-space: pre;"><br /></span></span></div><div><div style="text-align: center;"><span style="font-family: Arial;"><span style="font-size: 13.3333px; white-space: pre;"><br /></span></span></div>
<p id="pv"></p>
<p>參考劉任昌<a href="https://drive.google.com/file/d/17z6UZgN5fC2XCO1L8_BQs57dgQXzbwou/view?usp=sharing" target="_blank">金融市場講義</a>
</p><h1>劉任昌學習HTML+CSS+JavaScript程式碼</h1><h1>
留言
張貼留言