@Josh Powell: Sure here is the full source in HTML (below you'll find the Javascript Source written in Prototype)
======================================================================== HTML: ======================================================================== <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/ prototype.js"></script> <script type="text/javascript" src="javascript_in_prototype.js"></ script> <table> <tr class="fieldpair"> <td><input type="checkbox"/> Tennis Ball </td> <td> $<input name="price" type="text" value="5" /> </td> </tr> <tr class="fieldpair"> <td><input type="checkbox"/> Foot Ball </td> <td> $<input name="price" type="text" value="10" /> </td> </tr> <tr class="fieldpair"> <td><input type="checkbox"/> Base Ball </td> <td> $<input name="price" type="text" value="20" /> </td> </tr> </table> <p>Total Amount: $ <span id="total_amount">0</span></p> ======================================================================== Javascript_in_prototype.js ======================================================================== // Main calculation function function calculate() { var total = 0; $$(".fieldpair").each(function(fieldpair) { if (fieldpair.down("input:checked")) { var input = fieldpair.down('input:[name="price"]'); total += parseInt(input.value); } }); // Show the result $("total_amount").update(total); } // This is called when the document DOM has // been fully loaded by the browser. Event.observe(window, 'load', function() { // Do the initial calculation. Some fields might be pre-checked. calculate(); // Attach event handlers for click event on checkboxes $$(".fieldpair input:checkbox").each(function(elem) { elem.observe('click', calculate); }); // Attach event handlers for keyup event on text fields $$(".fieldpair input:textfield").each(function(elem) { elem.observe('keyup', calculate); }); }); On 1 sep, 21:57, Josh Powell <seas...@gmail.com> wrote: > can you send the html too?