In the Chrome developer tools 4 errors:

Uncaught SyntaxError: Unexpected token o bank.html: 1

Uncaught SyntaxError: Unexpected token o bank.html: 1

Uncaught SyntaxError: Unexpected token b bank.html: 1

Uncaught SyntaxError: Unexpected token b bank.html: 1

Values ​​are not substituted in points 4 and 6 after filling out the form.
Please help solve the problem.

bank.html:

function calculate() { var principal = document.loandata.principal.value; var interest = document.loandata.interest.value / 100 / 12; var payments = document.loandata.years.value * 12; var x = Math.pow(1 + interest, payments); var monthly = (principal * x * interest) / (x - 1); var payment = document.getElementById("payment"); var total = document.getElementById("total"); var totalinterest = document.getElementById("totalinterest"); if (isFinite(monthly)) { payment.innerHTML = monthly.toFixed(2); total.innerHTML = (monthly * payments).toFixed(2); totalinterest.innerHTML = ((monthly * payments - principal).toFixed(2)); } else { payment.innerHTML = ""; total.innerHTML = ""; totalinterest.innerHTML = ""; } } 
 .result { font-weight: bold; } #payment { text-decoration: underline; } 
 <html> <head> <title>Calculator on JavaScript</title> </head> <body> <form name="loandata"> <table> <tr> <td><b>Enter data:</b> </td> </tr> <tr> <td>1) Value of credit</td> <td> <input type="text" name="principal" onchange="calculate();"> </td> </tr> <tr> <td>2) Year percent:</td> <td> <input type="text" name="interest" onchange="calculate();"> </td> </tr> <tr> <td>3) How much time:</td> <td> <input type="text" name="years" onchange="calculate();"> </td> </tr> <tr> <td></td> <td> <input type="button" value="Рассчитать" onclick="calculate();"> </td> </tr> <tr> <td><b>Payment:</b> </td> </tr> <tr> <td>4) Pay per month:</td> <td>$<span class="result" id="payment"></span> </td> </tr> <tr> <td>5) The amount of payments:</td> <td>$<span class="result" id="total"></span> </td> </tr> <tr> <td>6) Общая сумма платежей по процентам:</td> <td>$<span class="result" id="totalinterest"></span> </td> </tr> </table> </form> </body> </html> 

  • one
    But the site is not just called "stackoverflow in Russian." - Regent
  • I vote for the closure of this issue as not relevant topic, because questions in Russian so must be asked in Russian - Duck Learns to Hide
  • one
    Your code is working. Try to execute the snippet I collected from your example. - VenZell
  • @VenZell, translating the question is a great idea. The code, by the way, really works, it is not clear what happened to the author. Typo and the letter "o" somewhere appeared? - Sergey Snegirev
  • @SergeySnegirev, in the original version of the error was not. Entirely copied code was completely working. Perhaps the author copied here the wrong version of the code on which he worked. - VenZell

0