sorry if i’m doing something monumentally stupid, but I can’t get this IF statement working…
What it does is that it checks certain values from a cookie, setting combo box defaults.
Through debugging I can see that all the cookie variables are correct, however the IF statement does not seem to read the value? The first two IF’s work correctly but the last else-if does not work.
Any help much appreciated, thanks
function checkBody() {
var cookie1 = readCookie("Text Colour");
textCol = cookie1 ? cookie1 : "#444";
var cookie2 = readCookie("Background Colour");
backCol = cookie2 ? cookie2 : "white";
var cookie3 = readCookie("Link Colour");
linkCol = cookie3 ? cookie3 : "#0424B5";
var cookie4 = readCookie("Heading1 Colour");
heading1Col = cookie4 ? cookie4 : "#0424B5";
var cookie5 = readCookie("Headings Colour");
headingsCol = cookie5 ? cookie5 : "#99975A";
var element = document.getElementById('colours');
if(textCol == cookie1 && backCol == cookie2)
element.value = "#444,white,#0424B5,#0424B5,#99975A";
else if(textCol == cookie1 && backCol == cookie2)
element.value = "black,yellow,black,black,black";
else if(textCol == cookie1 && backCol == cookie2)
element.value = "black,#87CEFA,black,black,black";
bodyStyle(textCol,backCol,linkCol,heading1Col,headingsCol);
}
All the
ifare same. the latter two are never reached.