stumpedone
01-10-2001, 12:15 PM
I have a form on my site that will calculate the grand total for a number of items ordered. The problem is - is that I need to calculate shipping on the number of books orders (ie. 1-30 books is 8.75, 31-60 books is 12, etc). This is the script as I have it now. Everytime you enter a value over 31, the tax just reads 8.75 - why - what am I missing?
function shipping() {
var shipping = 0;
var itemCount = 0;
itemCount = document.payform.qty1.selectedIndex + itemCount;
itemCount = document.payform.qty3.selectedIndex + itemCount;
if (itemCount == 0) shipping = 0;
if (itemCount == 1) shipping = Math.round(8.75 * 100);
if (itemCount >= 2 && itemCount <= 30) shipping = Math.round(8.75 * 100);
if (itemCount >= 31 && itemCount <= 60) shipping = Math.round(12.00 * 100);
if (shipping == 0) document.payform.shipping.value=decimal("00");
else document.payform.shipping.value=decimal(shipping);
}
function shipping() {
var shipping = 0;
var itemCount = 0;
itemCount = document.payform.qty1.selectedIndex + itemCount;
itemCount = document.payform.qty3.selectedIndex + itemCount;
if (itemCount == 0) shipping = 0;
if (itemCount == 1) shipping = Math.round(8.75 * 100);
if (itemCount >= 2 && itemCount <= 30) shipping = Math.round(8.75 * 100);
if (itemCount >= 31 && itemCount <= 60) shipping = Math.round(12.00 * 100);
if (shipping == 0) document.payform.shipping.value=decimal("00");
else document.payform.shipping.value=decimal(shipping);
}