I have a few javascript functions bellowThe setCookie function works perfectly but the one I am interesetd in is cookieWhatWeSay(name) this works partiallyCode:<script type="text/javascript"> function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } </script> <script type="text/javascript"> function cookieWhatWeSay(name) { cookie=getCookie(name); if (cookie!=null) { var value = cookie.GetCookieValue(); if (value == "inline") { document.getElementById('whatwesay1').style.display = 'inline'; document.getElementById('whatwesay2').style.display = 'none'; setCookie('whatwesay','inline',365); } else { document.getElementById('whatwesay1').style.display = 'none'; document.getElementById('whatwesay2').style.display = 'inline'; setCookie('whatwesay','none',365); } } } </script> </head> <body onLoad="cookieWhatWeSay('whatwesay')">I need to know how I can get the value from the cookie. Basically the cookie can have two values (i.e. inline or none) How do I get this value from the cookie and then use the if statements in the cookieWhatWeSay(name) function.
Hope you understand what I say
Please help.
Cheers - Zahid


I need to know how I can get the value from the cookie. Basically the cookie can have two values (i.e. inline or none) How do I get this value from the cookie and then use the if statements in the cookieWhatWeSay(name) function.
Reply With Quote
Bookmarks