javascript code:
function getCheckbox(name,id){
var check = 0;
var deger = "option-checkbox-"+id;
var dom = document.getElementById(deger);
if( dom.checked )
check += parseFloat( dom.value );
else check -= parseFloat( dom.value );
return check.toFixed(2);**//right value.(12.45)**
}
function getRadio(name,id) {
var radio=0;
var deger="option-radio-"+id;
var radio="option["+name+"]";
var selectedli = document.getElementsByName(radio);
var degerli = document.getElementById(deger);
if( selectedli.checked )
radio = parseFloat( degerli.value );
else radio = parseFloat( degerli.value )
return radio.toFixed(2)**//right value.(42.00)**
}
function getSelected(name,id) {
var selectedid="option["+name+"]";
var selecte = 0;
var selected = document.getElementById( selectedid );
selecte = parseFloat(selected.value);
return selecte.toFixed(2);**//right value.(-12.29)**
}
function toplam(name,id) {**//not expected(0)**
var toplan = 0;
toplan = getSelected(name,id)+getRadio(name,id)+getCheckbox(name,id);
$( '#toplam_goster' ).fadeOut(200, function(){
document.getElementById("toplam_goster").innerHTML = toplan;
});
$( '#toplam_goster' ).fadeIn(200);
}
.In the last function return 0. How can I fix it.
Thanks.