function readCookie(name)
{
var ca = document.cookie.split(';');
var nameEQ = name + "=";
for(var i=0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
document.ready(function() {
var color = readCookie(go);
if (color != null) {
var gs = document.createElement("link");
gs.type = "text/css";
gs.rel = "stylesheet";
gs.title = "mystyle"
gs.href = "images/audentio/gogreen/green.css";
var rs = document.createElement("link");
rs.type = "text/css";
rs.rel = "stylesheet";
rs.title = "mystyle"
rs.href = "images/audentio/gogreen/red.css";
var bs = document.createElement("link");
bs.type = "text/css";
bs.rel = "stylesheet";
bs.title = "mystyle"
bs.href = "images/audentio/gogreen/blue.css";
if (color == "green"){
document.getElementsByTagName("head")[0].removeChild(rs);
document.getElementsByTagName("head")[0].removeChild(bs);
document.getElementsByTagName("head")[0].appendChild(gs);
}
else if (color == "blue"){
document.getElementsByTagName("head")[0].removeChild(rs);
document.getElementsByTagName("head")[0].removeChild(gs);
document.getElementsByTagName("head")[0].appendChild(bs);
}
else (color == "red"){
document.getElementsByTagName("head")[0].removeChild(gs);
document.getElementsByTagName("head")[0].removeChild(bs);
document.getElementsByTagName("head")[0].appendChild(rs);
}
}
else {
return: false;
}
});
Hey guys, I’m no good with this stuff, it’s killing all the jQuery in my page (Though for reasons I won’t go into, I don’t want to use jQuery for the reading of the cookie, only the creating of it) so any chance someone can see the error?
Live Demo: http://wedesignthe.net/staff_uploads/eric/ad_development/demo/index.php
Find
else (color == "red"){and replace withelse if(color == "red"){The error due to this statement
else (color == "red"){where you just forgotifand change
to
remove : between return and falseand change
document.ready(function() {to$(document).ready(function() {or$(function() {Replace it
with