Here is a tiny javascript that calculates the sum of every column in a
table, even if the columns mix links, letters and numbers. Credit goes
to 4umi.com/web/javascript/tablesum.php

Caveats: All table cells must have at least one whitespace.

Put this in a code.embed.somename file, add <embed somename> in your
template.last and put [t id=sumtable] in your template.first


<input type='submit'  onclick='sumup(this)'  name='submit'
value='Summe'  /><p /><code>
<script language="javascript" type="text/javascript">

function sumup( o ) {
var t = [], cell,
  row = document.getElementById( 'sumtable' ).rows,
  i = row.length - 1,
  lastrow = row[i];
while(i--) {
  cell = row[i].cells; j = cell.length;
  while(j--) {
   if( !t[j] ) { t[j] = 0; }
   t[j] += parseFloat( cell[j].firstChild.nodeValue ) || 0;
  }
}
j = t.length; while(j--) {
  if( lastrow.cells[j] ) { lastrow.cells[j].firstChild.nodeValue =
t[j]; }
}
o.disabled = true;
}

</script>


Greetings, Martin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to