/    Sign up×
Community /Pin to ProfileBookmark

js functions works on Opera, IE, but not firefox

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*qty2+…prodx*qtyx) + delivery tax for each of the categories.

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;
[/code]

Thanks!

Edit: also, here’s a [URL=”http://kvirri.ath.cx/shop/form.php”]link[/URL] to my server.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@nshiellApr 23.2007 — What type of HTML tag is "'subtotal_' + x" an <input or a <div?
×

Success!

Help @kvirri spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...