如何制作共同基金 - SIP计算器?

时间:2018-03-11 11:45:22

标签: javascript html calculator sip

我正在为网站/博客制作SIP计算器。但我不知道该如何开始。我已经创建了一个基本的html CSS版本,但不知道如何计算数字。

2 个答案:

答案 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');
        }
});