PDA

View Full Version : JS code for background image in AnyLink?



trjonas
09-30-2007, 09:33 PM
1) Script Title: AnyLink Drop Down Menu

2) Script URL: http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

Is it possible to replace the background color code in the javascript of this script with a background image instead? I've tried doing it a couple different ways but then get an "error on page" in my browser (IE7) and the drop down menu does not appear at all.

Thank you!

ddadmin
10-01-2007, 12:07 AM
It's certainly possible using CSS. The below changes in red adds a background image to each menu item, and also, a different background image onmouseover:


#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;
font-weight: bold;
background: yellow url(original.gif);
}

#dropmenudiv a:hover{ /*hover background color*/
background: yellow url(hover.gif);
}

There are many variations of the background property in CSS.