I may be asking the wrong question but I am still fairly new to JavaScript. I need to create a cookie that will re-strict the number of usages a user has for an online product demo. In pseudo code, I assume it would be something like this:
if(readCookie('demo') == null){
createCookie('demo','1',1);} //Assuming the functions for setting a cookie and retrieving it have already been created.
else {
readCookie('demo');
}
if demo cookie has value{
increment the value by one
}
else if value exceeds 10 {
alert message //I set this so I could test out the function
}
Any help would be appreciated!
This page will tell you everything you need to know and even provides example functions for you to plug into your own code to make cookie handling very easy.
http://www.quirksmode.org/js/cookies.html