hiya, I'm very new to how javascript works and have inherited a website that contains a form that uses the calculate total function...which only works in IE. I've searched all over the net trying to find a solution to get this working across all browsers but not having much luck (mostly due to lack of experience), I'd really appreciate some help getting this sorted out...
This is the script for the calculate total function:
function calculate()
{
value = 0;
if (document.form.dvdle1b.checked==true) { value=value+0.5; }
if (document.form.dvdle2b.checked==true) { value=value+0.5; }
if (document.form.dvdle3b.checked==true) { value=value+0.5; }
if (document.form.dvdle4b.checked==true) { value=value+0.5; }
if (document.form.dvdle5b.checked==true) { value=value+0.5; }
if (document.form.subscribe.checked==true) {value=value+1; } //subscription is 60 but the rest are 30
if (document.form.dvd1.checked==true) { value=value+1; } //the current month dvd is 60 but the rest are 30
if (document.form.dvd9.checked==true) { value=value+0.5; }
if (document.form.dvd10.checked==true) { value=value+0.5; }
if (document.form.dvd11.checked==true) { value=value+0.5; }
if (document.form.dvd12.checked==true) { value=value+0.5; }
if (document.form.dvd13.checked==true) { value=value+0.5; }
if (document.form.dvd14.checked==true) { value=value+0.5; }
if (document.form.dvd15.checked==true) { value=value+0.5; }
if (document.form.dvd16.checked==true) { value=value+0.5; }
if (document.form.dvd17.checked==true) { value=value+0.5; }
if (document.form.dvd18.checked==true) { value=value+0.5; }
if (document.form.dvd19.checked==true) { value=value+0.5; }
if (document.form.dvd20.checked==true) { value=value+0.5; }
if (document.form.dvdvisual1.checked==true) { value=value+0.5; }
if (document.form.christmasdvd.checked==true) { value=value+0.5; }
if (document.form.pridedvd.checked==true) { value=value+0.5; }
if (document.layers)
{
if (document.form.cccountry[0].checked==true)
{
document.form.total.value = (value*60)*1.15;
}
if (document.form.cccountry[1].checked==true)
{
if (document.form.vat_number.value=='')
{
document.form.total.value = (value*60)*1.15;
}
else
{
document.form.total.value = (value*60);
}
}
}
if (document.all)
{
if (document.form.cccountry[0].checked==true)
{
temptotal = (value*60)*1.15;
document.form.total.value = temptotal.toFixed(2);
}
if (document.form.cccountry[1].checked==true)
{
if (document.form.vat_number.value=='')
{
temptotal = (value*60)*1.15;
document.form.total.value = temptotal.toFixed(2);
}
else
{
temptotal = (value*60);
document.form.total.value = temptotal.toFixed(2);
}
}
}
}
This is the code for the checkbox areas (not including it all as it's basically the same for all of the checkboxes):
<tr>
<td class="text2">May 2009 #299</td>
<td><input type="checkbox" name="dvd20" value="#299 - May 2009" onclick="calculate()" /></td>
<td class="text2">Apr 2009 #298</td>
<td><input type="checkbox" name="dvd19" value="#298 - April 2009" onclick="calculate()" /></td>
<td class="text2"><b>Mar 2009 #297</b></td>
<td><input type="checkbox" name="dvd18" value="#297 - Mar 2009" onclick="calculate()" /></td>
<td class="text2"><b>Feb 2009 #296</b></td>
<td><input type="checkbox" name="dvd17" value="#296 - Feb 2009" onclick="calculate()" /></td>
</tr>
<tr>
<td class="text2"><b>Jan 2009 #295</b></td>
<td><input type="checkbox" name="dvd16" value="#295 - Jan 2009" onclick="calculate()" /></td>
<td class="text2">Dec 2008 #294 </td>
<td><input type="checkbox" name="dvd15" value="#294 - Dec 2008" onclick="calculate()" /></td>
<td class="text2">Nov 2008 # 293 </td>
<td><input type="checkbox" name="dvd14" value="#293 - Nov 2008" onclick="calculate()" /></td>
<td class="text2">Oct 2008 # 292 </td>
<td><input type="checkbox" name="dvd13" value="#292 - Oct 2008" onclick="calculate()" /></td>
</tr>
and this is the code I have for where the total is supposed to show once the checkboxes are checked:
<td width="400">
<input type="text" name="total" size="8" style="font-family: Verdana; background-color: #C8FFC8; border-top: thin green solid; border-right: thin green solid; border-bottom: thin green solid; border-left: thin green solid" readonly="readonly"></td>
Hope someone can help....and thanks in advance
PS. Just to clarify, I didn't put together this code so please don't shoot me if it's truly awful!