CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 sum the values of an editable grid columns

Print topic Send  topic

Author Message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.