I am currently working on a site with a basic shopping cart facility. I have very little knowledge of javascript.
On selecting items from a form, the details are passed to the partsorder page and for is checked for qauntity selected. I am passing three cart parameters partcode, itemcode+description and qunatity.
the checking routine below returns an error 'subscript out of range 'i' this only happens if only 1 item is selected to purchase, 2 or more items and the routines work correctly, its doing my head in, can anyone help.
regards
Andy Sears email me
function checkQty () {
var intQ
var intTot = parseInt(document.forms[0].TotalOrders.value, 10)
for (i=0;i<intTot;i++) {
intQ = parseInt(document.forms[0].elements[(i5)+11+5].value, 10)
if (! intQ && intQ != 0) {
alert("Please ensure a numerical value is added.")
document.forms[0].elements[(i5)+11+5].focus()
return false;
}
}
}
Enter your message below
Sign in or Join us (it's free).