Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Marvellous work chaps, thanks for you help. Very good team work here is the full final code.</p> <p>function product_analysis(address, box) { if (box.checked) {</p> <pre><code>$('#product_' + box.alt).load(address); } else { $('#product_' + box.alt).load('http://www.divethegap.com/update/blank.html'); } document.getElementById('product_quantity_PRI_' + box.alt).value = box.value; </code></pre> <p>};</p> <p>var productIds = {};</p> <p>function product_totals(id) { productIds[id] = true; // store all id's as the totals are calculated var quantity = $c('product_quantity_' + id).value; var price = $c('product_price_' + id).value; var duration = $c('product_duration_' + id).value; var dives = $c('product_dives_' + id).value; var hire = $c('product_hire_' + id).value;</p> <pre><code>Number($c('product_price_total_' + id).value = price * quantity); Number($c('product_duration_total_' + id).value = duration * quantity); Number($c('product_dives_total_' + id).value = dives * quantity); Number($c('product_hire_total_' + id).value = hire * quantity); function $c(id) { return document.getElementById(id); </code></pre> <p>}<br> }</p> <p>function totalTotals() { var totalPriceTotal = 0; var totalDurationTotal = 0; var totalDivesTotal = 0; var totalHireTotal = 0;</p> <pre><code>for (var id in productIds) { // multiply by 1 to make sure it's a number totalPriceTotal += $c('product_price_total_' + id).value*1; totalDurationTotal += $c('product_duration_total_' + id).value*1; totalDivesTotal += $c('product_dives_total_' + id).value*1; totalHireTotal += $c('product_hire_total_' + id).value*1; } $c('GT_total_price').value = totalPriceTotal; $c('GT_total_duration').value = totalDurationTotal; $c('GT_total_dives').value = totalDivesTotal; $c('GT_total_hire').value = totalHireTotal; function $c(id) { return document.getElementById(id); </code></pre> <p>}</p> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload