Uj atvainojos piemirsu
Lai apstiprinātu dizainu.
Code
<select name="mydiz">
<option value="styles1" disabled="disabled">---Izvēlies---</option>
<option value="styles1"><font color="orange">Orģinālais</font></option>
<option value="styles7">Dzeltens</option>
<option value="styles6">Violets</option>
<option value="styles5">Melna</option>
<option value="styles4">Rozā</option>
<option value="styles3">Zaļa</option>
<option value="styles2">Zils</option>
</select>
<input type="button" name="save" onclick="dizsave(); return true;" value="Saglabāt" />
Tas pats skripts.
Code
<script>
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());
}
var diz = getCookie('mydiz') ? getCookie('mydiz') : 'styles1';
document.write('<link type="text/css" rel="StyleSheet" href="http://majaslapa.lv/'+diz+'.css">');
function dizsave() {
setCookie('mydiz',document.getElementsByName('mydiz')[0].value, 365);
location.reload();
}
</script>