0

HTMLコードを挿入できる見積もりシステムがあります。融資の募集を開始しました。ローン計算機のコードを挿入することはできましたが、ローンの長さ、金利、見積もり総額はわかっています。ジョブの合計 "{{ charge.total | currency }}" を唯一の変数として入力条件を設定する方法を理解する必要があります。次のような文(表ではない)を出力したいと思います。

APR 9.99% で 132 か月の資金調達プランを提供できます。これにより、毎月の支払い額は XXX.xx ドルに近くなります_ ____小さい活字

スタック オーバー フローは、ちょっとした変更が好きなスマート コーダーでいっぱいだと言われました。また、この種の小さなコーディングの質問に役立つビジネスを誰かが知っていれば幸いです.

ここで私が再利用しようとしたコード:

<script language="JavaScript">
<!--
function showpay() {
 if ((document.calc.loan.value == null || document.calc.loan.value.length == 0) ||
     (document.calc.months.value == null || document.calc.months.value.length == 0)
||
     (document.calc.rate.value == null || document.calc.rate.value.length == 0))
 { document.calc.pay.value = "Incomplete data";
 }
 else
 {
 var princ = document.calc.loan.value;
 var term  = document.calc.months.value;
 var intr   = document.calc.rate.value / 1200;
 document.calc.pay.value = princ * intr / (1 - (Math.pow(1/(1 + intr), term)));
 }

// payment = principle * monthly interest/(1 - (1/(1+MonthlyInterest)*Months))

}

// -->
</script>

The results of this loan payment calculator are for comparison purposes only.
They will be a close approximation of actual loan
repayments if available at the terms entered, from a financial institution. This
is being
provided for you to plan your next loan application. To use, enter values
for the
Loan Amount, Number of Months for Loan, and the Interest Rate (e.g.
7.25), and
click the Calculate button. Clicking the Reset button will clear entered
values.
<p>
<center>
<form name=calc method=POST>
<table width=30% border=5>
<tr><th bgcolor="#aaaaaa" width=25%><font color=black>Description</font></th>
<th bgcolor="#aaaaaa" width=25%><font color=black>Data Entry</font></th></tr>
<tr><td bgcolor="#eeeee">Loan Amount</td><td bgcolor="#eeeee" align=right><input
type=text name=loan
size=10></td></tr>
<tr><td bgcolor="#eeeee">Loan Length in Months </td><td bgcolor="#eeeee"
align=right>(Terms 132mo 47mo 37mo)<input type=text
name=months size=3></td></tr>
<tr><td bgcolor="#eeeee">Interest Rate </td><td bgcolor="#eeeee" align=right>( Rates 9.99%  7.99% 5.99%)<input
type=text name=rate
size=3></td></tr>
<tr><td bgcolor="#eeeee">Monthly Payment</td><td bgcolor="#2E64FE"
align=right><em>Calculated</em> <input
type=text name=pay size=10></td></tr>
<tr><td  bgcolor="#eeeee"align=center><input type=button onClick='showpay()'
value=Calculate></td><td bgcolor="#eeeeee" align=center><input type=reset
value=Reset></td></tr>
</table>
</form>
<font size=1>Enter only numeric values (no commas), using decimal points
where needed.<br>
Non-numeric values will cause errors.</font>
</center>
4

1 に答える 1

0

毎月の資金計画の例
詳細については、当社の Web サイトを参照してください。

http://www.generation3electric.com/financing" target="_blank">www.GEN3Electric.com
**月額 {{ job.total | division_by: 12|通貨}}

window.onload = function showpay() {

var princ = "{{ job.total }}";

var term1 = 132;
var intr1 = 9.99 / 1200;
var intrrate1 = 9.99;

var term2 = 47;
var intr2 = 7.99 / 1200;
var intrrate2 = 7.99;

var term3 = 37;
var intr3 =5.99 / 1200;
var intrrate3 = 5.99;

var cost1 = princ * intr1 / (1 - (Math.pow(1 / (1 + intr1), term1)));
var cost2 = princ * intr2 / (1 - (Math.pow(1 / (1 + intr2), term2)));
var cost3 = princ * intr3 / (1 - (Math.pow(1 / (1 + intr3), term3)));
var payment1 = Math.round(cost1);
var payment2 = Math.round(cost2);
var payment3 = Math.round(cost3);
var content = "**A  " 
              + term1 
              + " month financing plan at " 
              + intrrate1 + "% APR that will give you a monthly payment close to $"
              + payment1 
              +".**<BR> **A "
              + term2 + " month financing plan at " 
              + intrrate2 + "% APR that will give you a monthly payment close to $"
              + payment2 + ".**<BR>**A  " 
              + term3 + " month financing plan at " + intrrate3 
              + "% APR that will give you a monthly payment close to $"
              + payment3
              + ".**<BR>"   ;
document.getElementById("financing").innerHTML = content;

;}

于 2013-10-20T22:42:46.027 に答える