I have a for each loop in javascript, of which I need to output to an
ASP array. unfortunantly not too familiar with javascript..
the loop is for items ordered in a shopping cart. they are displayed
as rows of a table. all i need to do is get the same data into an ASP
array to use on the next page, specificaly the +theitem+ and
+thenumber+ variables.
i can pass any one variable like this:
document.writeln('<INPUT TYPE="hidden" NAME="itemName"
VALUE="'+theitem+'" SIZE="40">');
but need a way to get them all. thanks for any help!
-smhh
the javascript loop:
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+1) == '[') {
thisitem = 1;
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == ']') {
itemend = i;
thequantity = fulllist.substring(itemstart, itemend);
itemtotal = 0;
itemtotal = (eval(theprice*thequantity));
temptotal = itemtotal * 100;
subtotal = subtotal + itemtotal;
weighttotal = 0;
weighttotal = (eval(theweight*thequantity));
subweight = subweight + weighttotal;
itemlist=itemlist+1;
document.write('<tr><td>'+thequantity+'</td>');
document.writeln('<td>'+thenumber+'</td><td>
'+theitem+'</td><td>'+theprice+'</td><td>'+alterError(itemtotal)+'</td></tr>');
} else if (fulllist.substring(i,i+1) == '|') {
if (thisitem==1) theitem = fulllist.substring(itemstart, i);
if (thisitem==2) theprice = fulllist.substring(itemstart, i);
if (thisitem==3) thenumber = fulllist.substring(itemstart, i);
if (thisitem==4) theweight = fulllist.substring(itemstart, i);
thisitem++;
itemstart=i+1;
}
}