News

Log In Sponsors
Partner Sites
Tired of driving? Go online grocery shopping at eFoodDepot.com




cookies on java script problems



here is the code. // JavaScript Document function checkCookie(){ setCookie(true); if (document.cookie==null||document.cookie==""){ setCookie(true); return "visitor"; } if (getCookie("/login/")=="no") return "visitor"; return getCookie("/username/"); } function setCookie(newuser){ var expire_date = new Date(); expire_date.setDate(expire_date.getDate()+1); if (newuser) document.cookie = "mycookie=name; login=no; username=ben; expires=" + expire_date.toGMTString(); } function getCookie(field){ var str = ""; for (var i=document.cookie.search(field)+field.length-1 ; i<document.cookie.length ; i++){ if (document.cookie[i]==";") break; str += document.cookie[i]; } return str; } can't make it work and fing the regular expresions /login/ in the cookie and also /username/ why is that? someone can make it work? thanks

Click here to read the whole forum topic