{"id":289,"date":"2010-07-27T06:20:48","date_gmt":"2010-07-27T10:20:48","guid":{"rendered":"http:\/\/www.searchenginegenie.com\/programming-blog\/?p=289"},"modified":"2012-12-03T06:49:49","modified_gmt":"2012-12-03T10:49:49","slug":"change-your-page-background-color-dynamically-using-java-script","status":"publish","type":"post","link":"https:\/\/www.searchenginegenie.com\/programming-blog\/change-your-page-background-color-dynamically-using-java-script\/","title":{"rendered":"Change Your Page Background Color Dynamically using Java Script"},"content":{"rendered":"<div style=\"color: black;\">Following code is used to change a page color from your select option in select box.<\/div>\n<h3 style=\"color: red;\">Copy and Paste following code in a simple HTML page.<\/h3>\n<p>[html]<br \/>\n&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt;<br \/>\n&lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt;<br \/>\n\t&lt;head&gt;<br \/>\n\t\t&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=UTF-8&quot;&gt;<br \/>\n\t\t&lt;title&gt;Change Your page Background Color Using Java Script&lt;\/title&gt;<br \/>\n\t\t&lt;script type=&quot;text\/javascript&quot;&gt;<br \/>\n\t\t\tfunction changeTheme(selColor) {<br \/>\n\t\t\t\talert(selColor);<br \/>\n\t\t\t\tdocument.body.style.backgroundColor = selColor;<br \/>\n\t\t\t}<br \/>\n\t\t&lt;\/script&gt;<\/p>\n<p>\t&lt;\/head&gt;<br \/>\n\t&lt;body&gt;<br \/>\n\t&lt;h1&gt;Please Select Your Page Background Color..&lt;\/h1&gt;<br \/>\n\t\t&lt;select name=&quot;changescheme&quot; id=&quot;changescheme&quot; onChange=&quot;javascript:changeTheme(this.value)&quot;&gt;<br \/>\n\t\t\t&lt;option value=&quot;white&quot;&gt;White&lt;\/option&gt;<br \/>\n\t\t\t&lt;option value=&quot;red&quot;&gt;Red&lt;\/option&gt;<br \/>\n\t\t\t&lt;option value=&quot;blue&quot;&gt;Blue&lt;\/option&gt;<br \/>\n\t\t\t&lt;option value=&quot;orange&quot;&gt;Orange&lt;\/option&gt;<br \/>\n\t\t\t&lt;option value=&quot;black&quot;&gt;Black&lt;\/option&gt;<br \/>\n\t\t&lt;\/select&gt;<br \/>\n\t&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n[\/html]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following code is used to change a page color from your select option in select box. Copy and Paste following code in a simple HTML page. [html] &lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt; &lt;head&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=UTF-8&quot;&gt; &lt;title&gt;Change Your page Background Color Using Java Script&lt;\/title&gt; &lt;script type=&quot;text\/javascript&quot;&gt; function changeTheme(selColor) { [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[144,142,143],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-programming","tag-change-page-color-dynamic","tag-css","tag-stylesheet"],"_links":{"self":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":25,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":703,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/289\/revisions\/703"}],"wp:attachment":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/categories?post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/tags?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}