/    Sign up×
Community /Pin to ProfileBookmark

please help debug javascript

I have a form with javascript to figure out the totals.

What it needs to do is total the form and if 4 copies of the book is ordered the 5th is free. Now it is giving free copies away to easy.

You can see this online at: [url]http://www.awebforyou.com/borhatorahtest/testorder.html[/url]

the problem code is here

<INPUT readOnly size=6 value=0
name=sum_issues
update='{var qty=eval(document.order.SumQtyissues.value);var fours = Math.floor(qty / 4);var threes = qty%4;document.order.sum_issues.value=(qty-fours)*40;document.order.issuesRemark.value=(fours>0?fours+” free “:””)+(eval(threes)==3?”,you can get 1 more for free”:””);}’>
<SCRIPT>
document.order.sum_issues.update = ‘{var qty=eval(document.order.SumQtyissues.value);var fours = Math.floor(qty / 4);var threes = qty%4;document.order.sum_issues.value=(qty-fours)*
40;document.order.issuesRemark.value=(fours>0?fours+” free “:””)+(eval(threes)==3?”,you can get 1 more for free”:””);}’;
</SCRIPT>

Can anyone help me debug this?

Thanks

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @esthera 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.4,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...