Link to home
Start Free TrialLog in
Avatar of mhanslow
mhanslow

asked on

Javascript not working in Google Chrome & Safari

The following works fine in IE & Mozzilla but does not in Google Chrome or Safari.
Can anyone help me with where I am going wrong with this?
I cannot find where the problem is occuring yet am guessing it will be totally obvious.

Any help appreciated.
Thanks,
Matt
<script type="text/javascript">
function ReCalculate()
{
var BookQty=(parseFloat(window.document.getElementById("AdQty").value) + parseFloat(window.document.getElementById("CoQty").value) + parseFloat(window.document.getElementById("ChQty").value) + parseFloat(window.document.getElementById("SeQty").value) + parseFloat(window.document.getElementById("FdaQty").value) + parseFloat(window.document.getElementById("FdcQty").value));
window.document.getElementById("BookingQty").value= BookQty;
 
if(BookQty>10)
{
alert("You cannot select more then 10 tickets or you will be unable to proceed.");
window.document.getElementById("Proceed").disabled=true;
}
else
{
window.document.getElementById("Proceed").disabled=false;
}
 
 
 
var BookingValue=(toDollarsAndCents(document.getElementById("BookingQty").value * 1));
window.document.getElementById("BookValue").innerHTML = "$" + BookingValue;
 
var AdValue=(toDollarsAndCents(document.getElementById("AdQty").value *  parseFloat(window.document.getElementById("AdPrice").value) ));
window.document.getElementById("AdultValue").innerHTML = "$" + AdValue;
 
var CoValue=(toDollarsAndCents(document.getElementById("CoQty").value *  parseFloat(window.document.getElementById("CoPrice").value) ));
window.document.getElementById("ConcessionValue").innerHTML = "$" + CoValue;
 
var ChValue=(toDollarsAndCents(document.getElementById("ChQty").value *  parseFloat(window.document.getElementById("ChPrice").value) ));
window.document.getElementById("ChildValue").innerHTML = "$" + ChValue;
 
var SeValue=(toDollarsAndCents(document.getElementById("SeQty").value *  parseFloat(window.document.getElementById("SePrice").value) ));
window.document.getElementById("SeniorValue").innerHTML = "$" + SeValue;
 
var FdaValue=(toDollarsAndCents(document.getElementById("FdaQty").value *  parseFloat(window.document.getElementById("FdaPrice").value) ));
window.document.getElementById("FamadValue").innerHTML = "$" + FdaValue;
 
var FdcValue=(toDollarsAndCents(document.getElementById("FdcQty").value *  parseFloat(window.document.getElementById("FdcPrice").value) ));
window.document.getElementById("FamchValue").innerHTML = "$" + FdcValue;
 
 
var OrderTotal=(toDollarsAndCents((parseFloat(AdValue) + parseFloat(CoValue) + parseFloat(ChValue) + parseFloat(SeValue) + parseFloat(FdcValue) + parseFloat(FdaValue) + parseFloat(BookingValue))));
window.document.getElementById("OrderTotal").innerHTML = "$" + OrderTotal;
 
}
 
 
function toDollarsAndCents(n) {
  var s = "" + Math.round(n * 100) / 100;
  var i = s.indexOf('.');
  if(i < 0) return s + ".00";
  var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3);
  if (i + 2 == s.length) t += "0";
  return t;
}
 
 
</script>

Open in new window

SOLUTION
Avatar of prokvk
prokvk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial