Hi All Im trying to get this to work, but can only get it to work without putting the form tags in, and wont work with more than one set of the inputs.
the below is the result when i use ajax to search for item names, then want to caluculate the quantity * length (for total quantity), then total quantity * rrp_exc. the result should show in the the total field. It works, but not if the form tags are in and if there are multiple rows of the below inputs, eg, when there is more than one item retrieved in the search. any help would be great.
<script type="text/javascript">
function total()
{
var a = document.getElementById("rrp_exc");
var b = document.getElementById("quantity");
var e = document.getElementById("length");
if(a.value=="")
{
a.value = 0;
}
if(b.value=="")
{
b.value = 1;
}
if(e.value=="")
{
e.value = 1;
}
var f = b.value * e.value;
var d = a.value * f;
document.getElementById("total").value=d;
}
</script><input type="text" name="" id="rrp_exc" value="" onkeyup="total()">
<input type="text" id="quantity" name="" value="" onkeyup="total()">
<input type="text" id="length" name="" value="" onkeyup="total()">
<input type="text" name="" id="total" value="">