This code is great for calculating shipping charges. Just change the dollar amount and shipping amount to be charged to fit your needs.
Place the JavaScript in the head of your document. Then place the form of your choice within the body.
1. This code is great for calculating shipping charges. Just change the dollar amount and
shipping amount to be charged to fit your needs. Place the javascript in the head of your
document. Then place your form in the body.
<head>
<script type="text/javascript">
/* <![CDATA[ */
function calcShipping() {
var salesCost = parseInt(document.sale.price.value);
var salesTotal = salesCost;
if (salesCost <= 50)
salesTotal += 1.5;
else
salesTotal += salesCost * 10 / 100;
window.alert("Your sales total with shipping and handling is $" + salesTotal);
}
/* ]]> */
</script>
</head>
<body>
</body>
</html>