cookies
Moderator: General Moderators
ok forget about removing the cookie, i got another problem that i really need help in.
Here Is my function to set a cookie.
After i alter or update cookie shopping_cart , the cookie will have two shopping_cart="stuff". sence i have two now, i treally mess my code up, those any one have a clue that can help, thnx
Here Is my function to set a cookie.
Code: Select all
function setCookie()
{
//info are set into array item
var item = new Array(ite1,ite2,ite3,ite4,ite5,ite6,ite7,ite8,ite9,ite10,ite11,ite12,ite13,ite14,ite15,ite16,
ite15,ite16,ite15,ite16,ite17,ite18,ite19,ite20,ite21,ite22,ite23,ite24,ite25);
var price = new Array(pric1,pric2,pric3,pric4,pric5,pric6,pric7,pric8,pric9,pric10,pric11,pric12,
pric13,pric14,pric15,pric16,pric17,pric18,pric19,pric20,pric21,pric22,pric23,pric24,pric25);
num=0
the_cookie="";
for(count=0;count<25;count++)
{
if(itemїcount].length>1)
{
the_cookie = the_cookie+itemїcount]+"&"+priceїcount]+"/";
num++; //just a count on how many items is saved
}
}
if(num!=0)
{
var d = new Date()
d2 = d.getDate();
d2 = d2 + 2;
d.setDate(d2)
document.cookie = "shopping_cart=" + escape(the_cookie)+ ";expires="+ d;
alert("Your item will be save up to 48 hours");
}
else
{
alert("There are no items in the shopping cart.");
}
}