/    Sign up×
Community /Pin to ProfileBookmark

Javascript Math & IE

Hello,
I have made a basic javascrpt math function to add up some checkboxes
Unfortunately it does not seem to work in IE (PC). I have used it successfully on Firefox (Mac) and Safari (mac), but it is a no go on IE. It is the section of the following page ([url]http://fuzefit.com/enroll/signup.html[/url]) where TUITION prices are added 2/3 the way down. The basic formula result (total) works but if you click “add elective classes” which does a little extra math, it does not compute using IE (total2, total3, total4).

Any thoughts? Make Sense?

+++++++++++
The little script that figures the extra math

<script language=”javascript”>
function doCalculate()
{
//with document.ENROLL.myForm –> oops!
with(document.ENROLL)
{
total2.value = Math.round(total.value – 149);
total3.value = Math.round(total2.value * 1.1);
total4.value = Math.round(total3.value *
1 + 149);
}
}
</script>

+++++++++++++

The code for the main table adding the checkboxes:

<fieldset>
<dl>
<table width=”100%” border=”0″ cellpadding=”3″>
<tr>
<td height=”28″ colspan=”2″ bgcolor=”#C7D6F2″><div align=”center”><strong>FUZE TUITION &ndash; Effective September, 2008</strong> – you may select multiple options </div></td>
</tr>
<tr></tr>
<tr>
<td width=”50%” bgcolor=”#F8FCE8″><p>
<input name=”box” type=”checkbox” id=”box” value=”149″ />
<strong>Club Membership $149</strong> (One time and one per family),<br />
<input name=”box” type=”checkbox” id=”box” value=”-50″ />
<strong class=”boldtext”>I have a coupon for eNrollment</strong> ( a $50 value)</p> <label></label></td>
<td width=”50%” bgcolor=”#F8FCE8″>&nbsp;</td>
</tr>
<tr>
<td width=”54%” bgcolor=”#FFCC00″><div align=”center”><strong class=”boldtext”> 3-day-a-week schedule</strong></div></td>
<td width=”46%” bgcolor=”#FFFF66″><div align=”center”><strong class=”boldtext”> 2-day-a-week schedule</strong></div></td>
</tr>
<tr>
<td align=”center” bgcolor=”#FFCC00″><strong class=”boldtext”>GOLD/ Core classes </strong> <strong><u><br />
Month-Month:</u></strong></td>
<td align=”center” bgcolor=”#FFFF66″><strong class=”boldtext”>GOLD/ Core classes </strong><strong><u><br />
Month-Month:</u></strong></td>
</tr>
<tr>
<td><dd>
<input id=”platinum_1″ name=”box” type=”checkbox” value=”159″ />
$149 &ndash; 1st kid </dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”Gold_1″ name=”box” type=”checkbox” value=”129″ />
$119 &ndash; 1st kid</dd></td>
</tr>
<tr>
<td><dd>
<input id=”platinum_2″ name=”box” type=”checkbox” value=”149″ />
$139 &ndash; 2nd kid</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”Gold_2″ name=”box” type=”checkbox” value=”119″ />
$109 &ndash; 2nd kid</dd></td>
</tr>
<tr>
<td><dd>
<input id=”platinum_3″ name=”box” type=”checkbox” value=”129″ />
$129 &ndash; 3rd kid +</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”Gold_3″ name=”box” type=”checkbox” value=”99″ />
$99 &ndash; 3rd kid +</dd></td>
</tr>
<tr>
<td align=”center” bgcolor=”#FFCC00″><span class=”boldtext”><strong>platinum</strong></span><strong><br />
<u> SAVE 15% w/ 3-months prepaid (2 yr. price guarantee):</u>&nbsp;</strong></td>
<td align=”center” bgcolor=”#FFFF66″><span class=”boldtext”><strong>platinum</strong></span><u><strong><br />
SAVE 15% w/ 3-month prepaid (2-yr. price guarantee):</strong></u></td>
</tr>
<tr>
<td><dd>
<input id=”3m3_1″ name=”box” type=”checkbox” value=”387″ />
$129 &ndash; 1st kid</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”3m2_1″ name=”box” type=”checkbox” value=”297″ />
$99 &ndash; 1st kid</dd></td>
</tr>
<tr>
<td><dd>
<input id=”3m3_2″ name=”box” type=”checkbox” value=”357″ />
$119 &ndash; 2nd kid</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”3m2_2″ name=”box” type=”checkbox” value=”267″ />
$89 &ndash; 2nd kid</dd></td>
</tr>
<tr>
<td><dd>
<input id=”3m3_3″ name=”box” type=”checkbox” value=”297″ />
$99 &ndash; 3rd kid+</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”3m2_3″ name=”box” type=”checkbox” value=”237″ />
$79 &ndash; 3rd kid+</dd></td>
</tr>
<tr>
<td align=”center” bgcolor=”#FFCC00″><span class=”boldtext”><strong>diamond</strong></span><u><strong><br />
SAVE 25% w/ 12-month prepaid (2-yr. price guarantee):</strong></u></td>
<td align=”center” bgcolor=”#FFFF66″><span class=”boldtext”><strong>diamond</strong></span><u><strong><br />
SAVE 25% w/ 12-month prepaid (2-yr. price guarantee):</strong></u></td>
</tr>
<tr>
<td><dd>
<input id=”6m3_1″ name=”box” type=”checkbox” value=”1308″ />
$109 &ndash; 1st kid (only $11 per class)&nbsp;</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”6m2_1″ name=”box” type=”checkbox” value=”1068″ />
$89 &ndash; 1st kid</dd></td>
</tr>
<tr>
<td><dd>
<input id=”6m3_2″ name=”box” type=”checkbox” value=”1188″ />
$99 &ndash; 2nd kid</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”6m2_2″ name=”box” type=”checkbox” value=”948″ />
$79 &ndash; 2nd kid</dd></td>
</tr>
<tr>
<td><dd>
<input id=”6m3_3″ name=”box” type=”checkbox” value=”1068″ />
$89 &ndash; 3rd kid+</dd></td>
<td bgcolor=”#E9FADE”><dd>
<input id=”6m2_3″ name=”box” type=”checkbox” value=”828″ />
$69 &ndash; 3rd kid+</dd></td>
</tr>
<tr>
<td bgcolor=”#FFCC00″ class=”billets”><span class=”boldtext”>TOTAL AMOUNT DUE</span>:<span class=”boldtext”> $</span>
<input name=”total” type=”text” id=”total” value=”0″ /></td>
<td bgcolor=”#FFCC00″><span class=”billets”>
<input name=”total2″ type=”text” id=”total2″ value=”0″ size=”1″ />
</span></td>
</tr>
<tr>
<td bgcolor=”#FFCC00″><span class=”billets”>
<span class=”boldtext”>
<input name=”button” type=”button” onclick=”doCalculate()” value=”Add Elective Classes” />
</span> Elective Class Package

</span></td>
<td bgcolor=”#FFCC00″><span class=”billets”>
<input name=”total3″ type=”text” id=”total3″ value=”0″ size=”1″ />
</span></td>
</tr>
<tr>
<td bgcolor=”#FFCC00″><span class=”billets”>
<span class=”boldtext”>TOTAL AMOUNT DUE</span>:<span class=”boldtext”> $</span>
<input name=”total4″ type=”text” id=”total4″ value=”0″ />
</span></td>
<td bgcolor=”#FFCC00″>&nbsp;</td>
</tr>
</table>
<br />
</dl>
</fieldset>
+++++++++++++

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Logic_AliSep 20.2008 — There is an [I]indicated[/I] error on load, caused by the hideAllDivs function which is addressing a non-existent element.

doCalculate isn't being called by IE. Even if its executed from the address bar it has no visible effect. I suggest that you validate your markup before proceeding any further. http://validator.w3.org
Copy linkTweet thisAlerts:
@lambornauthorSep 20.2008 — OK, I'll check that out, thx
×

Success!

Help @lamborn 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.7,
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,
)...