Hello
I tried to make a form witch is calculate on the fly. But it does not work. Here is the code of the JS onload:
i got a Checkbox group (erscheinungen)
textfield (spalten1)
textfield (hoehemm1)
The value_mm is the VALUE of 'hoehemm'
The value_spalten is the VALUE of 'spalten'
The 'erscheinungen' is the VALUE of counted checkboxes
The 'rabatt' is 10 if 'erscheinungen' > 3
value_mm * value_spalten is the result 'totalmm'
totalpreis is the Product from 'totalmm' * 1.15
The 'wrabatt' is 'totalprise' / 100 * 'rabatt'
End Prise is: totalpreis - wrabatt
and The results should be displayd like this under the hoehemm field:
So how i get this, is this Possible or is this only a fiction?
Sorry about my English but this is not my favorit language.
Thanks for your help.
bambid
I tried to make a form witch is calculate on the fly. But it does not work. Here is the code of the JS onload:
window.addEvent('load', function() {
current_auswahl = 8;
spalten = $('spalten1');
hoehemm = $('hoehemm1');
.addEvent('onclick', function() {
erscheinungen = $$('.Chronoform checkbox:checked').length;
if(erscheinungen > 3){
var rabatt = 10;
};
}
// get the current value of the input field
spalten.addEvent('keyup', function() {
value_spalten = spalten.value;
value_totalmm = value_spalten * value_mm;
value_totalpreis = value_totalmm * 1.15 * current_auswahl;
value_wrabatt = value_totalpreis / 100*rabatt;
value_totalinkl = value_totalpreis - value_wrabatt;
$('spalten').innerHTML = value_spalten;
$('hoehemm').innerHTML = value_mm;
$('totalmm').innerHTML = value_totalmm;
$('totalpreis').innerHTML = value_totalpreis;
$('wrabatt').innerHTML = wrabatt;
$('totalinkl').innerHTML = value_totalinkl;
$('preisersch').innerHTML = value_totalinkl / rabatt;
});
hoehemm.addEvent('keyup', function() {
value_mm2 = hoehemm.value;
value_mm = value_mm2.length;
value_totalmm = value_spalten * value_mm;
value_totalpreis = value_totalmm * 1.15 * current_auswahl;
value_wrabatt = value_totalpreis / 100*rabatt;
value_totalinkl = value_totalpreis - value_wrabatt;
$('spalten').innerHTML = value_spalten;
$('hoehemm').innerHTML = value_mm;
$('totalmm').innerHTML = value_totalmm;
$('totalpreis').innerHTML = value_totalpreis;
$('wrabatt').innerHTML = wrabatt;
$('totalink').innerHTML = value_totalink;
$('preisersch').innerHTML = value_totalinkl / rabatt;
}); });
i got a Checkbox group (erscheinungen)
textfield (spalten1)
textfield (hoehemm1)
The value_mm is the VALUE of 'hoehemm'
The value_spalten is the VALUE of 'spalten'
The 'erscheinungen' is the VALUE of counted checkboxes
The 'rabatt' is 10 if 'erscheinungen' > 3
value_mm * value_spalten is the result 'totalmm'
totalpreis is the Product from 'totalmm' * 1.15
The 'wrabatt' is 'totalprise' / 100 * 'rabatt'
End Prise is: totalpreis - wrabatt
and The results should be displayd like this under the hoehemm field:
<h4>Höhe <span id='hoehemm'>50</span></h4>
<h4>Spalten <span id='spalten'>0</span></h4>
<h4>Total mm <span id='totalmm'>0</span></h4>
<h4>Preis <span id='totalpreis'>0</span></h4>
<h4>Wiederholungsrabatt <span id='wrabatt'>0</span></h4>
<h4>Total Preis nach Abzug des Rabattes <span id='totalinkl'>0</span></h4>
<h4>Preis pro Erscheinung <span id='preisersch'>0</span></h4>
So how i get this, is this Possible or is this only a fiction?
Sorry about my English but this is not my favorit language.
Thanks for your help.
bambid