function changebg() { var value=storybg.style.background; var valid=value.indexOf('white'); // check if bg is currently black or white if (valid==-1) { storybg.style.color="black"; // change background of
storybg.style.background="white"; storybg.bgColor = 'white'; document.getElementById("switch").innerHTML = "Switch: White on black"; // change span text document.cookie="switch=white"; // set cookie for smart choice } else { storybg.style.color = 'silver'; storybg.style.background = '#201500'; // works in IE storybg.bgColor = '#201500'; // my attempt for firefox document.getElementById("switch").innerHTML = "Switch: Black on white"; document.cookie="switch=black"; } }