hi, I'm having trouble with the style changer on my site, on my PC it works in Chrome, Firefox and IE but not Safari and on another PC it doesn't work in chrome. here it is
http://pixel-void.com/web_standards/index.html
use the links at the very bottom to change the style.
here is the javascript code for setting and getting the cookies for changing the style
Code:function style_choice(style){ if(style == undefined){ style = 'main'; } var txt = '<link rel="stylesheet" type="text/css" href="styles/' + style + '.css">'; return txt; } function setCookie(value){ //called from setCSS function var the_date = new Date(); the_date.setTime(the_date.getTime()+(30*24*60*60*1000)); var final_date = the_date.toGMTString(); document.cookie = 'style_cookie=' + value + '; expires=' + final_date + '; path=/'; } function getCookie(){ var my_cookie = document.cookie.split(';'); my_cookie = "x" + my_cookie //add any char to my cookie to make it a string return my_cookie.split("=")[1]; //get the value after = } function setCSS(style){ // call when user clicks style link setCookie(style); //set the new cookie window.location.reload(); //reload the page } var the_cookie = getCookie(); // get cookie info var default_style = style_choice(the_cookie); // set style with cookie info



Reply With Quote





Bookmarks