我需要一些帮助。我是新手。我正在尝试计算每日复利。我尝试了以下代码,但是没有用。我想要与此Calculate Image类似的内容。感谢您的帮助。
这是我的代码。但这不起作用
// var totalI = (amount* Math.pow((1 + (0.012/(365))), (365*(period|365)))));
$(function(){
var period = document.getElementById("period").value;
var amount = document.getElementById("amount").value;
if(document.getElementById("period").selectedIndex == 3){
document.getElementById("other").style.display='block';
period = document.getElementById("other").value;
period = period * 30;
} else {
document.getElementById("other").style.display='none';
var period = document.getElementById("period").value;
}
var totalI = (amount* Math.pow((1 + (0.012/(365))), (365*(period|365)))));
var inves = amount;
var totalAmount = +inves + +totalI;
//totalAmount = totalAmount + period
if(period == ""){
totalAmount = 0;
} else {
totalAmount = +inves + +totalI;
}
document.getElementById("total_p").value = "$" + round(totalAmount,2);
document.getElementById("price_g").value = "$" + round(totalI,2);
document.getElementById("inves_amount").value = "$" + inves;
});