Hello,
Can anyone please suggest a simple method for randomly changing the background color after the user re-loads / re-visits a web page?
Thanks
It's going to be a JS solution.
A quick google search will give you the answer.
Do you want a set of different colors or do you want the colors to be truly random?
Here's an example for a truly random color http://jsfiddle.net/djHyV/
document.body.style.background = "#"+((1<<24)*Math.random()|0).toString(16);
Demo: http://jsfiddle.net/tovic/djHyV/2/
This could be done with a backend language just as easily too. (I'd rather use a backend language too)
Nice bit of code-golf @Hompimpa
Hello,
Can anyone please suggest a simple method for randomly changing the background color after the user re-loads / re-visits a web page?
Thanks
It's going to be a JS solution.
A quick google search will give you the answer.
Do you want a set of different colors or do you want the colors to be truly random?
Here's an example for a truly random color http://jsfiddle.net/djHyV/
Demo: http://jsfiddle.net/tovic/djHyV/2/
This could be done with a backend language just as easily too. (I'd rather use a backend language too)
Nice bit of code-golf @Hompimpa