Zyra's front page //// HTML/JAVA Tricks etc //// SITE INDEX

Background Colour Changer


This Java conjuring trick allows the customer to choose a different background colour. Have a try - it looks like this:

This was found at www.fg-a.com where a lot of useful stuff is available for free download. The source-code of this example looks like this:

<p>
<form>
<input type="button" value="Click for Yellow" onclick="document.bgColor='yellow'">
<input type="button" value="Click for Blue" onclick="document.bgColor='blue'">
<input type="button" value="Click for Green" onclick="document.bgColor='green'">
<input type="button" value="How about White?" onclick="document.bgColor='white'">
<input type="button" value="Or define your own colour?" onclick="document.bgColor='#ffd0d0'">
</form>
</p>

Of course this has to be thought about carefully, as the text colour may disappear or clash very badly! Also it might not work the same on everyone's browser. But it's worth knowing this can be done. You may like to snaffle this code and adapt it to your own purposes.