Njokuchristian7
Posts: 3
|
Posted: 02/19/2013, 11:18 AM |
|
Hi there. I have an editable grid with three textboxes called and
creadit_unit, grade and grade_piont. And a seperate textbox named total.
With Javascript, i want to calculate the value of the grade_piont textbox based on the value in creadit_unit and grade. And Also to get value total = sum of grade_piont / sum of creadit_unit
My javascript code is:
<script language="Javascript">
function Show_Total(){
var credits, grades
credits = document.getElementsByName('creadit_unit');
grades = document.getElementsByName('grade');
var average = 0, totalcredits = 0;
for(var i = 0; i < grades.length; i++){
average += credits.value * grades.value;
totalcredits += Number(credits.value);
}
document.creditform.total.value = average / totalcredits;
}
</script>
It giving me NaN in the total textbox However, . Actually, it does nothing.
How can i do to make this code work with multiple rows in an editable grid?
I have tried many things, with no success
_________________
Love |
|
|
|