niente da fare. questo il sorgente:
codice:
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery.calculation.min.js"></script>
<script type="text/javascript">
var bIsFirebugReady = (!!window.console && !!window.console.log);
$("[id^=total_item]").calc(
// the equation to use for the calculation
"qty * price",
// define the variables used in the equation, these can be a jQuery object
{
qty: $("input[name^=qty_item_]"),
price: $("[id^=price_item_]")
},
// define the formatting callback, the results of the calculation are passed to this function
function (s){
// return the number as a dollar amount
return "$" + s.toFixed(2);
},
// define the finish callback, this runs after the calculation has been complete
function ($this){
// sum the total of the $("[id^=total_item]") selector
var sum = $this.sum();
$("#grandTotal").text(
// round the results to 2 digits
"$" + sum.toFixed(2)
);
}
);
</script>
<script>
document.createElement('article');
document.createElement('section');
document.createElement('hgroup');
document.createElement('header');
document.createElement('footer');
</script>
</head>
<body>
<table class="sortable" width="100%">
<thead>
<tr>
<th scope="col">Prodotto</th>
<th scope="col">Quantita</th>
<th scope="col">Prezzo</th>
<th scope="col">Totale €</th>
</tr>
</thead>
<tbody>
<tr><td>Prodotto A</td><td><input type="text" value="1" name="qty_item_1" id="qty_item_1" size="3"></td><td id="price_item_1">43.5</td><td id="total_item_1">43.5</td></tr>
<tr><td>Prodotto B</td><td><input type="text" value="1" name="qty_item_2" id="qty_item_2" size="3"></td><td id="price_item_2">43.5</td><td id="total_item_2">43.5</td></tr>
<tr><td>Prodotto C</td><td><input type="text" value="1" name="qty_item_3" id="qty_item_3" size="3"></td><td id="price_item_3">43.5</td><td id="total_item_3">43.5</td></tr>
<tr><td>Prodotto D</td><td><input type="text" value="1" name="qty_item_4" id="qty_item_4" size="3"></td><td id="price_item_4">43.5</td><td id="total_item_4">43.5</td></tr>
<tr><td colspan="3">TOTALE</td><td style="text-align: right" id="grandTotal">0,00</td>
</tbody>
</table>