Hi,
Can someone tell me why this script works when I use color "names" in the if comparison, but not when I use the hexadecimal code: (the problem only seems to be in the if statement, it's ok when I use hex code in the other lines)...strange
Thanks.
Can someone tell me why this script works when I use color "names" in the if comparison, but not when I use the hexadecimal code: (the problem only seems to be in the if statement, it's ok when I use hex code in the other lines)...strange
Code:
function toggleColor(){
coloredBkg = document.getElementById('bkg');
if(coloredBkg.style.backgroundColor=='green'){
coloredBkg.style.backgroundColor = '#FF579E';
}
else{
coloredBkg.style.backgroundColor = 'green';
}
}
Thanks.