Results 1 to 2 of 2

Thread: JS code for background image in AnyLink?

  1. #1
    Join Date
    Sep 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question JS code for background image in AnyLink?

    1) Script Title: AnyLink Drop Down Menu

    2) Script URL: http://www.dynamicdrive.com/dynamici...pmenuindex.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!

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    #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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •