and thanks in advance for any and all help provided. I've checked around on the internet and haven't found anyone else with my specific problem.
I am running Wordpress on a website and have two divs that I would like to enable the user to change the color of using Javascript/HTML. The background color can either be specified in CSS, or in HTML. I'm kind of a newbie at Javascript, but I was hoping to be able to create two Javascript variables, for example:
var headercolor="3366FF";
var maincolor="FFFFFF";
and then in HTML, for example, specify the background color as the variable.
<div id="header" style="background-color:javascript:document.write(headercolor);">
CONTENT HERE
</div>
<div id="main" style="background-color:javascript:document.write(maincolor);">
CONTENT HERE
</div>
Since the Javascript variables are given default values, they would display those when the page was loaded for the first time, but when a user clicks a link, the colors would change.
<a href="#" onclick=javascript:var maincolor="3366FF";>Click here to get a blue main background!</a>
Bascially, I'm wondering if any of this is possible. If so, how can I do it? If not, thanks for taking the time to read this post, and please let me know that it can't be done, or can be done another way.