0

Help me to check error in my JavaScript of installment calculator

please help me and Thank you So i want to make a credit card installment calculator, with fixed interest rate which is depended on its tenor. i make this so far, but it is not work! Can you please help me sir/mam? <!-- Kalkulator Cicilan--> <script> function showpay() { var princ = document.calc.loan.value; var bung = document.calc.ci.value; } if bung=3 { document.calc.pay.value = (princ/3)+(princ*0.99/100); } else if bung=6 { document.calc.pay.value = (princ/6)+(princ*0.99/100); } else if bung=12 { document.calc.pay.value = (princ/12)+(princ*0.75/100); } else if bung=24 { document.calc.pay.value = (princ/24)+(princ*0.75/100); } else if bung=36 { document.calc.pay.value = (princ/36)+(princ*0.75/100); } </script> <br /> <center> <form method="POST" name="calc"> <table border="0" style="width: 60%px;"> <tbody> <tr><th bgcolor="#aaaaaa" width="50%"><span style="color: blue;">installment</span></th> <th bgcolor="#aaaaaa" width="50%"><span style="color: blue;">Kalkulator</span></th></tr> <tr><td bgcolor="#eeeee">Nominal Transaksi</td><td align="right" bgcolor="#aaeeaa"><input name="loan" size="10" type="text" /></td></tr> <tr><td>Tenor/Bunga</td><td><select input="" name="ci"><option value="3">3Bulan 0.99%</option><option selected="" value="6">6Bulan 0.99%</option><option value="12">12Bulan 0.75%</option><option value="24">24Tahun 0.75%</option><option value="36">36Bulan 0.75%</option></select></td></tr> <tr><td bgcolor="#eeeee">Cicilan Tetap</td><td align="right" bgcolor="#eeaaaa"><em>Hasil</em> <input name="pay" size="10" type="text" /></td></tr> <tr><td align="center" bgcolor="#aaeeaa"><input onclick="showpay()" type="button" value="Hitung" /></td><td align="center" bgcolor="#eeeeaa"><input type="reset" value="Ulang" /></td></tr> </tbody></table> </form> </center>

8th Jan 2019, 12:00 PM
Roy
Roy - avatar
1 Answer
+ 3
Roy Your problems are as follows, first, the function showpay() should include all of the conditional statements. Next, there is the same syntax error with every conditional statement. The proper syntax is Ex. if(bung==3){...}.
8th Jan 2019, 4:00 PM
ODLNT
ODLNT - avatar