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

Javascript 如何制作共同基金-SIP计算器?,javascript,html,calculator,sip,Javascript,Html,Calculator,Sip,我正在为网站/博客制作SIP计算器。但我不知道该怎么开始。我已经创建了一个基本的html CSS版本,但不知道如何计算数字。你能给我计算sip的公式吗?嘿,Keshav,请查看此网站及其后端。-该页面没有提供公式,因为它使用php。请参阅以下文章:1。2.你可以查看这个网站,你能给我计算sip的公式吗?嘿,Keshav,请查看这个网站及其后端。-该页面没有提供公式,因为它使用php。请参阅以下文章:1。2.你可以查看这个网站 var investment = 800; //principal

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

你能给我计算sip的公式吗?嘿,Keshav,请查看此网站及其后端。-该页面没有提供公式,因为它使用php。请参阅以下文章:1。2.你可以查看这个网站,你能给我计算sip的公式吗?嘿,Keshav,请查看这个网站及其后端。-该页面没有提供公式,因为它使用php。请参阅以下文章:1。2.你可以查看这个网站
  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.
$('#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');
        }
});