Hi,

i spent a few hours and can't get past this simple code, my first If works, but the else always fail once the bg color has changed to pink.
The initial color is red. If I click once, it turns into pink as expected. If I click again, (once the background has changed to pink), it does not do anything where as I would like it to change into Green, and then Pink, then Green

Any clues? am I using the wrong listener?

function changeWrapperBackgroundColor()
{
var wrapper
wrapper = document.getElementById("wrapper");
if(wrapper.style.backgroundColor !== "Pink")
{
wrapper.style.backgroundColor = "Pink";
}
else
{
wrapper.style.backgroundColor = "Green";
}
}
I would then call the above function in my window.onload = init;
as below:
wrapper.addEventListener('click',changeWrapperBackgroundColor,false)