Hello, There were lots of arguments held with this ticket. Here is the simple solution for FR3@K function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; alert('Cookie set with value :: ' + value); } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) { var val = c.substring(nameEQ.length,c.length); alert('Reading cookie as :: ' + val); return val; } } return null; } function eraseCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; alert('Cookie Deleted successfully.'); } </script> <body> <a href="#" onClick = "createCookie('wide1', 'Medium', 'time()-3600')">Create cookie 1</a><br> <a href="#" onclick="readCookie('wide1')" class="page">Read cookie 1</a><br> <a href="#" onclick="eraseCookie('wide1', '','-1')" class="page">Delete cookie 1</a> PHP: Hope this will solve your as well as other forum member's issues.. Regards
i really appreciate that you tried to solve my problem , but this code is still not the thing that i am trying to do. I need the cookie value to be retrieved like this: <body id="page" if cookie value = normal , echo class="cookie value" else echo class="font-small width-fluid">
ok this thread can be closed, i got a js script from joesgraphics , thanks to him , he is really helpful , helped me a lot , for about 2 hours on msn. +rep to him