DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Change The Background Color Of The Page

12.26.2011
| 2839 views |
  • submit to reddit
        This is a kind of useless piece of JavaScript code, although I suppose it could be useful for something. Whether this is just a waste of time or not, I will present you with the code straightaway, that will allow you to dynamically change the background color of the page. 

<script language="JavaScript">
<!--
function changeBGC(color){
document.bgColor = color;
}
//-->
</script>

<a href="#" onClick="javascript:changeBGC('#000099')">Click Blue</a>

<a href="http://www.java-forums.org/blogs/eclipse/"><strong>Eclipse</strong></a> and <a href="http://www.java-forums.org/blogs/eclipse-ide/"><strong>Eclipse IDE</strong></a> tips.