backt next

Changing Background Color


Using JavaScript, You can change your background color dynamically.


Select your favorite background color:

White Pink Blue Green


To understand what is going on, take a look at how the link is coded.

<form>
<input type="radio" name="color" value="white" onClick="document.bgColor='ffffff'">White
<input type="radio" name="color" value="pink" onClick="document.bgColor='ffb6c1'">Pink
<input type="radio" name="color" value="blue" onClick="document.bgColor='add8e6'">Blue
<input type="radio" name="color" value="green" onClick="document.bgColor='90ee90'">Green
</form>


bgColor is the property that changes background color.



Back to JavaScript homepage | Back | Next | Email me