I’m new and I could really use some help, since I’ve spent several hours scouring Google for Chrome, IE6 Javascript troubleshooting overlaps with no luck. I am using a Javascript shopping cart for a fictional site. It is not a legitimate shopping cart, but I do sincerely wish I could get it to work for this sample website. One of my pages with the shopping cart code is: http://kschmitt.aiwsites.com/imd215/fullsun.htm (starts line 49). The desire effect is that the user is able to click “Add to Cart” for a flower and the item shows up in the cart on the side with an adjustable quantity, name, unit price, and total price. This code works in IE7, IE8, Safari, and Firefox, but doesn’t work in IE6 and Chrome. I’m including the URL for an image of the working and unworking versions and the NaN error I’m getting: http://ksdemo.50webs.com/shopping_cart_issues.jpg. I’m hoping that if I can fix it on one browser like IE6, it will work in Chrome as well. I tried adding parseInt to the value pq and parseFloat to the value to pc in this section:
Code:
if ((numitems==0) && (cart != "")) //If the number of products in the cart is 0 and there isn't any strings with data
{
numitems = cart;
//alert('numitems equal ' + numitems);
for (i=1;i<=numitems;i++)
{
parseFloat(pc) = pc;
parseInt(pq) = pq;
//read cookies in cart
pd = readCookie('product'+i);
pc = readCookie('price'+i);
pq = readCookie('qty'+i);
items[i] = new Item(pd,pc,pq);
}
}
It didn’t work so I pulled it back out. I do believe that the browser is reading the cookies, because if you click “Complete Order” after adding something to the cart, all fields (quantity, name, unit price, and total) do show up on the Checkout Page.
I hesitate to put the full code on here because it is long. The code is inline within the fullsun.htm file because it wouldn’t work in an external file and this was the only piece of code I could find for a shopping cart that I could manipulate to show while the user is browsing the page. I would appreciate any help, even if you could just point me to what section of the code might be the problem or have any nice Javascript-IE6 help websites. As much as I wish IE6 didn’t exist, I do need it to work in that browser. I’m less concerned about Chrome, but I suspect the problem is caused by the same thing in both of them.
Bookmarks