PD: Nunca me llevé bien con cálculo financiero ni JacaScript
Código:
<table align="center" border="0" cellpadding="2" cellspacing="0" width="506"> <tbody><tr> <td width="502" valign="top"> <form action="POST" name="myform"> <table bgcolor="#666" border="0"> <tbody><tr> <td width="304" height="81" colspan="2" align="center"> <script language="JavaScript"><!-- function Morgcal() { form = document.myform LoanAmount= form.LoanAmount.value DownPayment= "0" AnnualInterestRate = form.InterestRate.value/100 Years= form.NumberOfYears.value MonthRate=AnnualInterestRate/12 NumPayments=Years*12 Prin=LoanAmount-DownPayment MonthPayment=Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100 form.NumberOfPayments.value=NumPayments form.MonthlyPayment.value=MonthPayment } // --></script> <font color="#FFFFFF" face="arial narrow" size="4"><b>Calculador de Hipotecas</b> </font><br>Ingrese y decida sus condiciones</td></tr> <tr> <td> <table width="357" border="0" cellpadding="2"> <tbody><tr> <td width="130" align="right"><font color="#FFFFFF" face="arial narrow" size="2">Monto del crédito en USD</font></td><td width="79"><font color="#FFFFFF" face="arial narrow" size="2"> <input size="10" name="LoanAmount" value="0" onBlur="Morgcal()" onChange="Morgcal()" type="text"> <br> </font></td></tr> <tr> <td align="right"><font color="#FFFFFF" face="arial narrow" size="2">Tasa anual fija</font></td><td><font color="#FFFFFF" face="arial narrow" size="2"> <input name="InterestRate" type="text" disabled onBlur="Morgcal()" onChange="Morgcal()" value="18.0" size="3"> % <br> </font></td></tr> <tr> <td align="right"><font color="#FFFFFF" face="arial narrow" size="2">Plazo del crédito</font></td><td><font color="#FFFFFF" face="arial narrow" size="2"> <input size="3" name="NumberOfYears" value="12" onBlur="Morgcal()" onChange="Morgcal()" type="text"> Años<br> </font></td><td width="75"><font color="#FFFFFF" face="arial narrow" size="2"> <input name="morgcal" value="Calcular" language="JavaScript" onClick="Morgcal()" type="button"> </font></td></tr> <tr> <td colspan="3"><font color="#FFFFFF"></font></td></tr> </tbody></table></td></tr> <tr> <td> <table width="336" border="0" cellpadding="2"> <tbody><tr> <td width="137" align="right"><font color="#FFFFFF" size="2">Cantidad de cuotas</font></td><td width="153"><font color="#FFFFFF" face="arial narrow" size="2"> <input name="NumberOfPayments" type="text" disabled value="0" size="7"> <br> </font></td></tr> <tr> <td align="right"><font color="#FFFFFF" face="arial narrow" size="2">Cuota mensual USD</font></td><td><font color="#FFFFFF" face="arial narrow" size="2"> <input name="MonthlyPayment" type="text" disabled value="0" size="7"><br> </font></td></tr> <tr> <td align="right"> </td> <td> </td> </tr> </tbody> </table></td></tr> </tbody></table></form></td> </tr> </tbody></table>