我正在为网站/博客制作SIP计算器。但我不知道该如何开始。我已经创建了一个基本的html CSS版本,但不知道如何计算数字。
答案 0 :(得分:3)
var investment = 800; //principal amount
var annualRate = 2;
var monthlyRate = annualRate / 12 / 100; //Rate of interest
var years = 30;
var months = years * 12; //Time period
var futureValue = 0; //Final Value
futureValue = investment * (Math.pow(1 + monthlyRate, months) - 1) /
monthlyRate;
SIP is nothing but just Compound interest amount on Principal amount.
答案 1 :(得分:1)
$('#btn-sip').click(function(event) {
var investment = $('#inv-amount').val(); // Total investment
var years = $('#inv-period').val(); // No of years
var annualRate = $('#inv-exreturn').val(); // annual Rate
if (investment == '' || years == '' || annualRate == '') {
alert('please enter all values');
} else {
var monthlyRate = annualRate / 12 / 100;
var months = years * 12;
var futureValue = 0;
var total = ((investment*years*annualRate));
futureValue=(investment * (1+monthlyRate) * ((Math.pow((1+monthlyRate),months)) - 1)/monthlyRate);
$('#total-investment').val(Math.round(total));
$('#end-value').val(Math.round(futureValue));
$('#sip-cal-result').css('display', 'block');
}
});