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 ""
}
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 setStyle()
{
var Style=getCookie('Style');
if (Style!=null && Style!="")
{
document.getElementById("Skin").href= Style;
}
}
And here is the call to set the cookie -
<div class="Blue" onmouseover="previewStyle('rayslinksblue.css');"
onclick="setCookie('Style','rayslinksblue.css',365);">White on Blue</div>
This will not set the cookie. I am using the Web Developer toolbar in Firefox to
check for cookies after attempting to set it, and it reports there are no cookies set.
Can anyone see what is causing this to fail? I keep looking at it, and I can't
spot any mistakes...
Later, Ray Parrish
This post has been edited by Ray Parrish: 14 November 2008 - 08:18 AM

Help




Back to top








