PDA

View Full Version : change bg by clicking



TurdFurgason
12-16-2004, 03:34 AM
http://www.dynamicdrive.com/dynamicindex4/imagelight.htm

On this page you have the option to "Click to see how the images look in a black background..." then the background goes black. You can click again to make it white again. How are you able to do that?

cr3ative
12-16-2004, 03:29 PM
This is the code used:


<script language="JavaScript1.2">
function changesettings(){
if (document.all){
if (document.body.style.cssText==''||document.body.style.backgroundColor=='white')
document.body.style.cssText="background-color:black;color:white;background-image:url()"
else
document.body.style.cssText="background-color:white;color:black"
}
}
</script>

<a href="changesettings();">Click here</a>

Is the code used to change the backdrop. It only works in Internet Explorer.

cr3ative

TurdFurgason
12-17-2004, 03:12 AM
Im still a little confused. When I tried to use it, it went to a new page.