0
我正在製作這種形式,它是費用計算器,它有兩個字段,收費到期和費用收費,然後有一個說話的平衡,最後第四個字段是文本字段說狀態它使用JavaScript自動更新根據餘額作爲付款,未付或分期付款它工作正常,但只有問題是由於某些原因,當某些特定的值輸入狀態字段變爲空白它不會更新根據JavaScript應該說分期付款,這裏是我的JavaScript比較JavaScript中的兩個字段
function ff_feecalc_new_init()
{
setInterval("calc()", 500)
}
function calc(){
ff_getElementByName('status').value='';
ff_getElementByName('balance').value=Number(ff_getElementByName('amountdue').value)-Number(ff_getElementByName('amountpaid').value);
if (ff_getElementByName('amountpaid').value==0 && ff_getElementByName('amountdue').value>0){
ff_getElementByName('status').value="unpaid";
}
if(ff_getElementByName('amountpaid').value>0){
if ((ff_getElementByName('balance').value <ff_getElementByName('amountdue').value){
ff_getElementByName('status').value="installments";
}
}
if (ff_getElementByName('amountpaid').value == ff_getElementByName('amountdue').value && ff_getElementByName('amountpaid').value>0){
ff_getElementByName('status').value="paid";
}
}
我做錯了什麼?
有一種支架丟失 – 2013-03-15 20:04:54
哪裏有托架丟失Chiel? – VoronoiPotato 2013-03-15 20:16:00
我建議擴大你的問題與這個jsfiddle。 http://jsfiddle.net/ – 2013-03-15 20:16:10