Hi! I’m having a problem with the function posted below. It’s actually my first REAL javascript attempt.
I have several tables, and each one of them has items (selling stuff). This items are grouped, and each group has its own delivery tax.
The idea is that if a box (subtotal_n) should display the raw total (prod1*qty1+prod2
If i replace this function with an alert(x), it works in firefox (2.0) too. Otherwise, it will work only in IE (6) and opera (9.10).
Here is the function, maybe someone can have a look at it.
The argument passed (x) shows which category should have its cost refreshed.
[code]
<!– rcc = recompute cost –>
var total = 0;
var qtv;
var qty;
var z;
for (l=1;l<=cat_items[x]+1;l++)
{
cx=l-1;
if (item_price[x][cx]>0)
{
qtv=(document.getElementById(‘qty_’ + x + “_” + cx).value);
qtv=Math.ceil(Math.abs(qtv));
z = item_price[x][cx] * qtv;
total = total + z;
}
}
if (total>0) {total=total+cat_delivery[x];}
total=Math.ceil(total*100);
total=total/100;
document.getElementById(‘subtotal_’ + x).value = total;
Thanks!
Edit: also, here’s a [URL=”http://kvirri.ath.cx/shop/form.php”]link