Friday, June 18, 2004

CSS

Background Changing with CSS and Javascript: Ever wanted to have different background for your site and have them change on the fly? Now you can.

Step 1: Create a different class for each image / background style you want to use in your document.
Example:
<style type="text/css">
<!--
body.brown {
background: #000000 url(brownBack.gif);
}
body.red {
background: #000000 url(redback.gif);
}
-->
</style>

Step 2: Create one link for each style you created above.
Example:
<a href="#" onMouseDown="body.className='brown';">One</a>
<a href="#" onMouseDown="body.className='red';">Two</a>

Step 3: Enjoy. That's it! I don't have an example site up right now but hopefully I will in the future.

0 Comments:

Post a Comment

<< Home