Issue
I have made a website with one specific theme, is there a way to change the color of the background/text of the website when you refresh it? here is some code which can only change the background. How to make it so it will pick a theme with the text and background
Solution
if you want change color of background or text, use DOM to access this style and edit:
var bgcolorArr = new Array("silver", "#BAF3C3", "#c3baf3", "red", "green", "blue")
document.body.style.backgroundColor = bgcolorArr[Math.floor(Math.random()*bgcolorArr.length)]
Update!! Use Array literals is shorter new Array():
var bgcolorArr = ["silver", "#BAF3C3", "#c3baf3", "red", "green", "blue"]
Answered By - VMT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.