什麼是簡化這種從1-19去的最佳途徑?
var backer1 = document.getElementById("backer-prediction-1").value;
var incentive1 = document.getElementById("incentive-cost-1").value;
var totalIncentive1 = parseInt(backer1,10) * parseInt(incentive1,10);
document.getElementById("incentive-total-1").value = totalIncentive1;
var backer2 = document.getElementById("backer-prediction-2").value;
var incentive2 = document.getElementById("incentive-cost-2").value;
var totalIncentive2 = parseInt(backer2,10) * parseInt(incentive2,10);
document.getElementById("incentive-total-2").value = totalIncentive2;
最後一個我發佈他們給了我一個「for」循環。
還在學習這個東西..很新,謝謝!!!
而「for」循環在這種情況下也不起作用? – pagliuca 2012-07-18 05:04:20
for循環用於其他代碼,我不知道如何將其應用於此:/ – Reuben 2012-07-18 05:05:41
與此處所做的相同。 – 2012-07-18 05:05:53