Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change site background image on Button Rollover

Status
Not open for further replies.

oldriv

Programmer
Apr 27, 2009
1
GB
Hiya,

My site layout is:
[Main Image] - single JPEG
[1][2][3][4] - four individual JPEG (Buttons)

I am hoping to achieve the following:
Button [1] is rolled-over {
-[Main Image] changes // MainImage1
-Site background changes // BGImage1 }

Button [2] is rolled-over {
-[Main Image] changes // MainImag2
-Site background changes // BGImage2 }

.. and so on

I'd appreciate if anyone could point me in the right direction? I've found lots of tutorials for basic roll-over buttons, but not the extra function. Any advice much appreciated.
 
Hi

JavaScript:
function ch(what)
{
  document.getElementById('mainimage').src='MainImage'+what+'.jpg'
  document.body.style.backgroundImage='url(BGImage'+what+'.jpg)'
}
</script>
HTML:
<img src="" id="mainimage">
<img src="1.jpg" onmouseover="ch(1)">
<img src="2.jpg" onmouseover="ch(2)">
<img src="3.jpg" onmouseover="ch(3)">
<img src="4.jpg" onmouseover="ch(4)">

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top