Answer:
It took me a bit to debug the code and find the error, the code at the bottom will do the job that you want.
I think there’s just some minor mishaps. Forgive me if I’m wrong, because I program mainly in C++ and C#. I think the first problem is using element to change the color of the object. Im not sure if javascript is the same but in most c-based languages when you define a new variable you derive that exact variable. In C++ you can do what’s called a reference, or using pointers to point to a location of a variable, but for hte most part i think when you say
var element = document.getElementById(id);
i think this creates a new value variable for our situation, and sets it to the value of our object.
So when we do:
element.style.backgroundColor = “#FFF”;
this actually only changes our DRIVED instance, and not our intended object.
Second error was the use of background instead of backgroundColor, which is very minor. I understand that background is used for images, im not even familiar with these terms myself.
If you’re having further issues, please email me.
Anyway. i hope that helps.
Bye!
coffee