By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,620 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

Javascript won't run in IE 6...

P: 1
I've ran out of debugging ideas. If anyone knows why this won't run in IE 6 please let me know. It works fine in Fire Fox 2.0.0.3 and Netscape (version unknown). I suspect there is something basic about IE and Javascript that I'm wholly unaware of. I've edited the HTML code to include just the essential elements because it exceeded the allowed word count.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Los Gatos Tennis Academy | Academy Registration</title>


<script language="JavaScript" type="text/javascript">

<!--
function validate()
{
var elems = document.forms['form1'].elements;
var helpmsg = '';

if (elems['01_PlayersName'].value == "")
{helpmsg = helpmsg + 'Please enter Players Name' + '\n';}
if (elems['02_BirthDate'].value == "")
{helpmsg = helpmsg + 'Please enter Birthdate' + '\n';}
if (elems['03_ParentsName'].value == "")
{helpmsg = helpmsg + 'Please enter Parents Name' + '\n';}
if (elems['04_PhoneNumber1'].value == "")
{helpmsg = helpmsg + 'Please enter Phone Number' + '\n';}
if (elems['05_ParentsName'].value == "")
{helpmsg = helpmsg + 'Please enter Parents Name' + '\n';}
if (elems['06_Address1'].value == "")
{helpmsg = helpmsg + 'Please enter Address' + '\n';}
if (elems['07_PhoneNumber'].value == "")
{helpmsg = helpmsg + 'Please enter alternate Phone Number' + '\n';}
if (elems['08_Address2'].value == "")
{helpmsg = helpmsg + 'Please enter second Address' + '\n';}
if (elems['email'].value == "")
{helpmsg = helpmsg + 'Please enter Email' + '\n';}
if (elems['10_SchoolAttending'].value == "")
{helpmsg = helpmsg + 'Please enter School Attending' + '\n';}
if (elems['11_TournamentExperience'].value == "")
{helpmsg = helpmsg + 'Please enter Tournament Experience' + '\n';}
if (elems['160_IndemnityAgreement'].checked)
{}
else
{helpmsg = helpmsg + 'IndemnityAgreement' + '\n';}



if (helpmsg !== '')
{
alert(helpmsg)
return false;
}
else
{return true;}
}

function calculate()
{
var elems = document.forms['form1'].elements;
var total = 0;
if (elems['12_AcademyDayPass'].checked) { total += 60.00; }
if (elems['13_Academy10-pack'].checked) { total += 500.00; }
if (elems['14_HighSchoolDiscount'].checked) { total = total - (total * 0.15); }
if (elems['15_SiblingDiscount'].checked) { total = total - (total * 0.50); }
elems['16_total'].value = total;
}

function hidiscount()
{
document.forms['form1'].elements['15_SiblingDiscount'].checked = false;
calculate();
}

function sibdiscount()
{
document.forms['form1'].elements['14_HighSchoolDiscount'].checked = false;
calculate();
}


//-->

</script>

</head>

<body>

<form name="form1" method="post" actio=""/>

<table width="757" border="1" cellpadding="5" cellspacing="1" bordercolor="#333333">
<tr>
<td colspan="4"><span class="style47">Wednesdays - Fridays 5:00-7:00 p.m. @ Los Gatos High School<br />
Saturdays 12:00-4:00 p.m. @ Los Gatos High School</span></td>
</tr>
<tr>
<td width="4%"><input name="12_AcademyDayPass" onclick="calculate()" type="checkbox"></td>
<td width="34%"><span class="style47">Academy Day Pass<br />
(4 Hour Academy Practice) </span></td>
<td width="22%"><span class="style47">$60</span></td>
<td width="40%" rowspan="3"><div align="center"></div></td>
</tr>
<tr>
<td><input name="13_Academy10-pack" onclick="calculate()" type="checkbox" value="500" /></td>
<td><span class="style47">Academy 10-Pack<br />
(40 Hours of Academy Practice </span></td>
<td><span class="style47">$500</span></td>
</tr>
<tr>
<td colspan="2"><p class="style52">&nbsp;</p>
<p class="style64">DISCOUNTS</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><input name="14_HighSchoolDiscount" onclick="hidiscount()" type="checkbox" value="0.10" /></td>
<td colspan="3"><span class="style47">Los Gatos High School Students: 15% Discount</span></td>
</tr>
<tr>
<td><input name="15_SiblingDiscount" onclick="sibdiscount()" type="checkbox" value="0.50" /></td>
<td colspan="3"><span class="style47">Sibling Discount*: 50% Discount<br />
<span class="style29">*Discount applicable only if players participate in the same LGTA program.</span></span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="4"><table width="99%" border="1" align="right" cellpadding="5" cellspacing="0" bordercolor="#EAEAEA">
<tr>
<td><table width="100%" border="0" align="right" cellpadding="0">
<tr>
<td width="12%"><div align="left"><span class="style63">TOTAL DUE:</span></div></td>
<td width="88%"><input type="text" name="16_total" size="10" onclick="calculate()" /></td>
</tr>
<tr>
<td colspan="2"><div align="left"><span class="style60">*Please make checks payable to Todd Dissly Athletics.</span></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>

<tr>
<td><input name="160_IndemnityAgreement" type="checkbox" onclick="validate()" /></td>
<td colspan="3"><span class="style60">I have read and agree with the terms of this agreement.</span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="4"><div align="center">
<input name="Submit" onclick="return validate()" type="submit" class="style63" value="Register Now" />
</div></td>
</tr>

</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
Apr 30 '07 #1
Share this Question
Share on Google+
1 Reply


iam_clint
Expert 100+
P: 1,208
you wrote your validation kinda awkward.


var elems = document.forms.form1;
elems.whatever.value
Apr 30 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.