PDA

View Full Version : Skin Selector Problem!



MasumX
05-12-2005, 07:53 AM
Ok, im having problem with this skin selector javascript is that everytime u select a skin it callz back the "Default" or previous selected skin on "Refresh" so how to stop it from calling the previous or default color css to appear on refresh...and just show the recent Selected color only!!...ok here's the code n tell me whatz up wid it..so, if u wanna see alive demo what i meant? check this out.and btw "Select" only "NAVY BLUE" cuz all other is gold color :( so, just select the Navyblue color and "Refresh" the window and u will see "Gold"=default color is coming even after selecting Navyblue color..but it does show navyblue color tho... n hope u understand what i mean..

goldenbangla.com/test.php



var scheme = getCookie('template1');
if (scheme == 'Pink') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/pink.css">');
} else if (scheme == 'Green') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/green.css">');
} else if (scheme == 'Purple') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/purple.css">');
} else if (scheme == 'Navyblue') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/navyblue.css">');
} else if (scheme == 'Slateblue') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/slateblue.css">');
} else if (scheme == 'Burlywood') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/burlywood.css">');
} else if (scheme == 'Default') {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/gb.css">');
} else {
document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="style/gb.css">');
}


function changeskin(change) {
var scheme = change;
var name = 'template1';
var pathname = location.pathname;
var myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
var ExpDate = new Date ();
ExpDate.setTime(ExpDate.getTime() + (180 * 24 * 3600 * 1000));
setCookie(name,scheme,ExpDate,myDomain);
}
function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}

function setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
((path == null) ? "" : "; path=" + path) +
((domain == null) ? "" : "; domain=" + domain) +
((secure == null) ? "" : "; secure");
}