hlcno
06-23-2012, 11:51 PM
Hi all,
I have this simple script that calculates a customers current cart total and shows when they are eligible for free shipping.
For some reason it won't work in old versions of IE. I did some googling and some people say onload doesn't work in IE but I can't find an alternative method.
Any help would be great, thanks1
<script language=JavaScript>
<!--
function checkprice(price) {
var freeprice = 99;
price = price.replace(/^\$|,/g, '');
if(price >= freeprice) document.getElementById('message').innerHTML = 'Congratulations! Shipping is free!';
else document.getElementById('message').innerHTML = 'You are only $' + (freeprice - price).toFixed(2) + ' away from being eligible for free shipping!';
}
//-->
</script>
<body onload='checkprice("<%Cart.Total%>")';>
<span id="message"></span>
</body>
I have this simple script that calculates a customers current cart total and shows when they are eligible for free shipping.
For some reason it won't work in old versions of IE. I did some googling and some people say onload doesn't work in IE but I can't find an alternative method.
Any help would be great, thanks1
<script language=JavaScript>
<!--
function checkprice(price) {
var freeprice = 99;
price = price.replace(/^\$|,/g, '');
if(price >= freeprice) document.getElementById('message').innerHTML = 'Congratulations! Shipping is free!';
else document.getElementById('message').innerHTML = 'You are only $' + (freeprice - price).toFixed(2) + ' away from being eligible for free shipping!';
}
//-->
</script>
<body onload='checkprice("<%Cart.Total%>")';>
<span id="message"></span>
</body>