F
fiona
Be grateful if someone could help me out with this.
I'm working on a shopping cart where I want the choice of adding four
different items to it
What's happining at the moment is when I add something from the top box
named productid id it adds the item to the cookie.
when I try to add something from any other "productid" it still adds
the
first item quantity to the cart
Now, I imagine this is because I have the variables all named the
same, but
I don't know how to change it do i add in
four variables in place of the "id" variable now?
Thanks for any help
function setCookie1()
{
alert("Setting the cookie");
alert("Quantity:"+document.purchaseForm.priceText.value);
// var id = prompt("What's your product ID?","");
//var qty = prompt("What's the quantity?", "");
id = document.purchaseForm.productId.value;
qty = document.purchaseForm.priceText.value;
var previousCookie= document.cookie; //retrieve cookies held
var previousData = unescape(previousCookie);
var newData = id +":" + qty;
newData = newData+"/"+previousData;
var cookie1 = escape(newData);
document.cookie = cookie1;
}
I'm working on a shopping cart where I want the choice of adding four
different items to it
What's happining at the moment is when I add something from the top box
named productid id it adds the item to the cookie.
when I try to add something from any other "productid" it still adds
the
first item quantity to the cart
Now, I imagine this is because I have the variables all named the
same, but
I don't know how to change it do i add in
four variables in place of the "id" variable now?
Thanks for any help
function setCookie1()
{
alert("Setting the cookie");
alert("Quantity:"+document.purchaseForm.priceText.value);
// var id = prompt("What's your product ID?","");
//var qty = prompt("What's the quantity?", "");
id = document.purchaseForm.productId.value;
qty = document.purchaseForm.priceText.value;
var previousCookie= document.cookie; //retrieve cookies held
var previousData = unescape(previousCookie);
var newData = id +":" + qty;
newData = newData+"/"+previousData;
var cookie1 = escape(newData);
document.cookie = cookie1;
}