I'm trying to have a user who visits my site be able to select the style sheet they'd like to see and it save as a cookie. I was given some javascript that would help me out and it has to a certain extent. With firefox the user can select the style and it saves, all is well. With Internet Explorer 6 and Service Pack 2 installed the style doesn't get saved and it reverts back to the default. I've tested this on several computers all with Service Pack 2 and IE6. I have no idea why it does. I don't get any errors. If anyone could help me out that would be great, I am very new to Javascript and know nothing about it. My site is
www.dempsey.cjb.net and here is the javascript that I currently use.
-----code------
var CSS_COOKIE_VAR = "LastCSS";
function changeStyle( oSel )
{ if (sCSS = oSel.value)
{ setStyle( sCSS );
var expires = new Date( 2010, 1, 1 );
document.cookie = CSS_COOKIE_VAR + "=" + escape( sCSS ) +"; expires=" + expires.toGMTString() + ";" ;
}
}
function setStyle( sCSS )
{ document.getElementById("external_style").href = sCSS;
}
function loadStyle()
{ aCookie = document.cookie.split(";");
for (i=0; i< aCookie.length; i++)
{ aName = aCookie[i].split("=");
if (aName[0] == CSS_COOKIE_VAR )
{ setStyle( aName[1] );
document.getElementById("control").value = aName[1];
}
}
}