GreyBoy
01-18-2006, 12:00 PM
I am trying to change the page background when a img is clicked. Ive tried about 6 different ways, but non seem to work. I think I must be missing something...
<script type="text/javascript">
<!--
function changeBG ( id )
{
if(id == 1){ document.body.backgroundImage = "url(http://files.tagworld.com/81561a514b5870dc4856bacfd1bf11d08fb2.gif)"; }
else if(id == 2){ document.body.backgroundImage = "url(http://files.tagworld.com/cc7605e7a49254594d99bf67d354ad1f7f5d.jpg)"; }
else if (id == 3){ document.bodybody.backgroundImage = "url(http://files.tagworld.com/244dd645e8bea05f4408a63871a6a8684a6e.jpeg)"; }
else{document.body.style.backgroundImage = "url(http://files.tagworld.com/244dd645e8bea05f4408a63871a6a8684a6e.jpeg)"; }
}
//-->
</script>
<p>Choose a background for my page: </p>
<table width="368" cellspacing="0" cellpadding="0">
<tr>
<td width="95"><img src="http://files.tagworld.com/81561a514b5870dc4856bacfd1bf11d08fb2.gif" width="75px" height="75px" id="1" onClick="changeBG(1);" /></td>
<td width="95"><img src="http://files.tagworld.com/cc7605e7a49254594d99bf67d354ad1f7f5d.jpeg" width="75px" height="75px" id="2" onClick="changeBG(2);" /></td>
<td width="96"><img src="http://files.tagworld.com/244dd645e8bea05f4408a63871a6a8684a6e.jpeg" width="75px" height="75px" id="3" onClick="changeBG(3);" /></td>
</tr>
</table>
<script type="text/javascript">
<!--
function changeBG ( id )
{
if(id == 1){ document.body.backgroundImage = "url(http://files.tagworld.com/81561a514b5870dc4856bacfd1bf11d08fb2.gif)"; }
else if(id == 2){ document.body.backgroundImage = "url(http://files.tagworld.com/cc7605e7a49254594d99bf67d354ad1f7f5d.jpg)"; }
else if (id == 3){ document.bodybody.backgroundImage = "url(http://files.tagworld.com/244dd645e8bea05f4408a63871a6a8684a6e.jpeg)"; }
else{document.body.style.backgroundImage = "url(http://files.tagworld.com/244dd645e8bea05f4408a63871a6a8684a6e.jpeg)"; }
}
//-->
</script>
<p>Choose a background for my page: </p>
<table width="368" cellspacing="0" cellpadding="0">
<tr>
<td width="95"><img src="http://files.tagworld.com/81561a514b5870dc4856bacfd1bf11d08fb2.gif" width="75px" height="75px" id="1" onClick="changeBG(1);" /></td>
<td width="95"><img src="http://files.tagworld.com/cc7605e7a49254594d99bf67d354ad1f7f5d.jpeg" width="75px" height="75px" id="2" onClick="changeBG(2);" /></td>
<td width="96"><img src="http://files.tagworld.com/244dd645e8bea05f4408a63871a6a8684a6e.jpeg" width="75px" height="75px" id="3" onClick="changeBG(3);" /></td>
</tr>
</table>