Есть скрипт, он меняет CSS сайта при нажатии на кнопку. Но после перезагрузки сайта, стили вообще пропадают.
Приходится всё время нажимать на кнопку. Можете помочь мне сделать, что бы после обновления страницы выбранный CSS сохранялся.
Вот скрипт:
В верх сайта:
Code
<link rel="stylesheet" type="text/css" href="/_st/my.css" id="changeable_styles">
<script>
function setCookie(a,b,c){if(c){var d=new Date();d.setTime(d.getTime()+(c*24*60*60*1000));var e="; expires="+d.toGMTString()}else var e="";document.cookie=a+"="+b+e+"; path=/"};function getCookie(a){var b=a+"=";var d=document.cookie.split(';');for(var i=0;i<d.length;i++){var c=d[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(b)==0)return c.substring(b.length,c.length)}return null};function eraseCookie(a){setCookie(a,"",-1)};
</script>
Перед $BODY$:
Code
<script>
+function() {
std = 'http://cs-biz.ru/_st/my.css'; // стандартные стили
if(getCookie('color_of_style')){var color=getCookie('color_of_style')}else{var
color=std};document.getElementById('changeable_styles').href=color;
}();
</script>
А вот и сам скрипт. Вставлять в блок:
Code
<input type="button" onclick="setCookie('color_of_style', 'blue.css', 365); document.getElementById('changeable_styles').href = 'CSS_URL#1';" value="Black design">
<input type="button" onclick="setCookie('color_of_style', 'red.css', 365); document.getElementById
('changeable_styles').href = 'CSS_URL#2';" value="White design">
Помогите.Добавлено (17.11.2011, 20:14)
---------------------------------------------
помогите плиз. что никто не знает?