Forum Moderators: open
function setCookie(name,value,days)
{var expires = "", date = new Date();
if(days)expires = "; expires=" + new Date(date.setDate(date.getDate()+days)).toGMTString();}
setCookie('i', 'index', 365);
In this case the cookie name is set to "i" the cookie value is set to "index" and is set to expire in a year 365.
Then I have an array and it grabs the array index number that is currently being used. So if array number [2] is currently being used the code grabs the 2.
var array=[]; the index number that was grabbed is stored in the javascript variable index. Or var index Which all works fine tested with alert(index); which shows the current number it grabbed and that array is using. I need help to know how to get that number grabbed each time into a cookie? I tried setCookie('x', 'index', 365); Please let me know how to set the array index into a cookie. Thank you very much. [1][edited by: 101Jen at 10:05 am (utc) on Sep. 16, 2008]
array= ["stuff"]; (webmaster world not including first number)
array[2] = ["stuff2"];
array[3] = ["stuff3"];
But when I test it in an alert, alert( document.cookie = name+"="+value+expires+"; path=/" ); where it shows all the cookie values read, it shows the cookie value as the word "index" instead of the number index has grabbed.