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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a background Image of a tag/element!

Status
Not open for further replies.

A1Defiant

Technical User
May 24, 2001
22
0
0
GB
Trying to have a piece of script to change background-image of a element.
i.e.
<DIV style=background-image:url('MyPic1.gif')>
Text Inside Div element
</DIV>
I'm wanting to control it using a eventhandler mouse-over but what code do I use to change the background-image to say 'MyPic2.gif'
Code Tried so far:

<DIV id=&quot;Layer0&quot; style=&quot;position:absolute;
background-image:url(SideButtonsOut.gif);
Top:20px;Left:10px;width:145px;height:44px;
text-align:center;padding:8px&quot;
onmouseover=this.style.background-image=(SideButtonsIn.gif);
Links
</DIV>
 
onmouseover=this.style.backgroundImage=&quot;url('SideButtonsIn.gif')&quot;;
 
Cheers For that Bangers!
U dont know how many combinations I tried but that obviously wasn't one!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top