1 回答

TA貢獻1833條經(jīng)驗 獲得超4個贊
解釋:
你在第一個陳述中有一個錯字
if
;它應(yīng)該==
代替=
但你也可以通過使用簡化表達式<=
。您必須放在條件
document.getElementById("month").innerHTML
之外if
,否則其余元素將不會發(fā)送到網(wǎng)頁。我還使用模板文字來簡化您的表達式并使其更適合未來。
解決方案:
if(parseInt(downPayment) <= 0.35*parseInt(vprice) ) {
? var resm = `Your downpayment should be minimum 35% of the price - (↑ ${nf.format((Math.round(vprice*0.35)))})`;
? }
??
??
? else if(parseInt(downPayment) > parseInt(vprice)) {
? ? var resm = `Your downpayment should be below 100% of the price - (↑ ${nf.format((Math.round(vprice*0.100)))})`;
? }
??
? else {
var resm = `1st Year Monthly Rental: ${nf.format((Math.round(month)))} <br>2nd Year Monthly Rental: ${nf.format((Math.round(month2)))} <br>3rd Year Monthly Retal: ${nf.format((Math.round(month3)))}`;
? }
? document.getElementById("month").innerHTML = resm;
? google.script.run.userClicked({
? ? vprice,
? ? downPayment,
? ? rate,
? ? period,
? ? month
? })
? //sending to HTML by ID
? document.getElementById("subL").innerHTML = "Sub Loan - "+? nf.format((Math.round(subL)));
? document.getElementById("YearBulk1").innerHTML = "1st Year End Bulk Payment - "+ nf.format((Math.round(YearBulk1)));
?document.getElementById("YearBulk2").innerHTML = "2nd Year End Bulk Payment - "+ nf.format((Math.round(YearBulk2)));
?document.getElementById("YearBulk3").innerHTML = "3rd Year End Bulk Payment - "+ nf.format((Math.round(YearBulk3)));
添加回答
舉報