我創建了一個用於計算每月費用的表單。我遇到的問題是我收集前一頁(會話到數據)的信息的最後一頁,該信息自動填充最後一頁上的字段。我創建了一個JavaScript,假設總頁數減去五個字段,但這不起作用。如果我將會話從加載部分刪除數據,JavaScript完美地工作。Javascript頁面加載總數
頁的問題: http://www.garranteedsolutions.com/budget?chronoform=BudgetPage7
的Javascript:
window.addEvent('domready', function() {
$('spendable').addEvent('change', rekenen1);
$('housetotal').addEvent('change', rekenen1);
$('cartotal').addEvent('change', rekenen1);
$('creditortotal').addEvent('change', rekenen1);
$('misctotal').addEvent('change', rekenen1);
});
function rekenen1(){
$('grandtotal').value = Number($('spendable').value) + Number($('housetotal').value) + Number($('cartotal').value) + Number($('creditortotal').value) + Number($('misctotal').value) ;
}
這是我一直在使用的代碼,但它需要在表格框的改變要執行的操作。我已經試過這
的Javascript:
window.addEvent('domready', function() {
rekenen1;
$('spendable').addEvent(rekenen1);
$('housetotal').addEvent(rekenen1);
$('cartotal').addEvent(rekenen1);
$('creditortotal').addEvent(rekenen1);
$('misctotal').addEvent(rekenen1);
});
function rekenen1(){
$('grandtotal').value =
Number($('spendable').value) + Number($('housetotal').value)
+ Number($('cartotal').value) + Number($('creditortotal').value)
+ Number($('misctotal').value);
}
這是我的延續尋求幫助,從這裏開始:http://www.chronoengine.com/forums/viewtopic.php?f=2&t=67427&p=269741#p269741
我不知道的Javascript非常好,我很接近完成此表格。我只是無法讓Grand Total合計。
這不起作用。控制檯說以下內容: '未捕獲的ReferenceError:refenen1沒有定義 rokboxPathbudget:76 (匿名功能)的mootools-core.js:370 hmootools-core.js:33個 Array.implement.eachmootools核。 js:39 invoke.fireEventmootools-core.js:369 g' 我需要將只讀關掉嗎?我真的很想這樣,最終用戶不能改變總數。 – 2012-03-18 19:13:16
它稱爲rekenen1的函數不是refenen1。我認爲你拼錯了這個名字 – ajimix 2012-03-19 13:29:13