I need help with some elements for my website, to enable logged in users to be able to alter the colour or background of their logged in area. I am looking for the best way to quickly accomplish this.
I would like something similar to this:
onclick="document.getElementById('id1').style.color = 'red'"> Click Me!
Though it needs to be permanent and remain after logging back in.
Here's a simple solution I made in jsfiddle. http://jsfiddle.net/tycyy15L/5/
window.onload = function() {
var boxlength = document.getElementsByClassName("coloredBox").length;
for(i = 0; i < boxlength; i++){
document.getElementsByClassName("coloredBox")[i].onclick = function(){
document.body.style.backgroundColor = this.style.backgroundColor;
}
}
}
(see js fiddle for the rest) and cookie version.
If it needs to be permanent, you'll most likely need to use a database. If it's semi-permanent, you could use cookies like my fiddle does.