Simple If Else statement to change div Color
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?
I would then call the above function in my window.onload = init;
wrapper = document.getElementById("wrapper");
if(wrapper.style.backgroundColor !== "Pink")
wrapper.style.backgroundColor = "Pink";
wrapper.style.backgroundColor = "Green";
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread