Images not appearing on menu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
pdof@earthlink.net
Beginner
Beginner
Posts: 4
Joined: Mon Oct 03, 2005 2:44 am
Location: Fayetteville, GA, USA

Images not appearing on menu

Post by pdof@earthlink.net »

Hello! I hope someone can help me:

I am using the menu successfully and am happy with its appearance. However I want to use the same menu (with the same menu_data.js file) on sub-pages, which are located in directories.

As soon as I put the menu on a page inside a directory, the images disappear. I've spent 5 hours on this problem, and by changing the source code as such: "../images/image.gif" and "images/image.gif" and so on, I can get them to appear alternately on either the root page or the subdirectory page, but not on both at the same time.

Help!! I know this must have a simple solution, but I've tried everything I can think of and nothing works.. I still get the dreaded red "X" where my images should be. :cry:

Can anyone help me with this? Thanks! By the way, my menu is inside a table, in case that makes a difference.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Have you tried the full path to the image instead of relative paths?

Ruth
pdof@earthlink.net
Beginner
Beginner
Posts: 4
Joined: Mon Oct 03, 2005 2:44 am
Location: Fayetteville, GA, USA

Images not appearing on child menus

Post by pdof@earthlink.net »

Hello Ruth! Yes, I tried that and that didn't work either. I got a very lengthy, very detailed email from Steve, another user who had the same problem and was able to fix it. However, I followed his instructions and they didn't work for me.

Do you have any other suggestions? I need to be able to use this menu on every page of my site (whether located in a sub-directory or a root directory), with the ability to make a change to the menu and have it automatically replicate throughout the site (in other words, building a separate menu for each subdirectory is not an option for me... we will probably have 25-30 subdirectories).

This is for a school; it is a free license so I'm not entitled to tech support; my only option is for some kind soul to voluntarily help me figure this out! Thanks for trying... let me know if you have any other suggestions.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

You are entitled to all the resources of this forum. However, we need a bit more than you've given us. A URL (as requested) would be most helpful.
John
User avatar
kendra
Advanced
Advanced
Posts: 24
Joined: Wed Sep 28, 2005 5:55 am

Post by kendra »

I think I get what his problem might be.. I had the problem when I set the image path based on the location of menu_data.js, you need to use the path for the page, not the menu files.

To fix the problem just create a global folder called /menu for all your menu files then use a root relative path its alot less confusing as you have only 1 set of menu files for the whole site.

1) create a /menu folder
2) copy all your menu files to there

Now when you need your menu files just use the root relative path.

NOTE:You NEED the starting slash, thats most important. This will tell the src to start back in the root so /menu is the same as http://mysite.com/menu


example:

<script type="text/javascript" src="/menu/menu_data.js"></script>
same goes for your images...

overimage="/menu/whitedots.gif";

This will fix the probem, trust me, and is actually much better because if you need to add a new item to your menu, just change it in

mysite/menu/menu_data.js and they all change, since all menus use that file!


Kendra
pdof@earthlink.net
Beginner
Beginner
Posts: 4
Joined: Mon Oct 03, 2005 2:44 am
Location: Fayetteville, GA, USA

Post by pdof@earthlink.net »

Thank you, Kendra -- that did the trick! I think Steve's solution would have worked, too, if I could have set it up the way he did... I think I did something wrong.

BTW, Ruth -- thank you also for trying to help. As it turns out, the absolute path to the images DID work... I'm not sure why it did not the first time, but it made logical sense to me that it SHOULD work so I erased and rewrote that line of script and then the images worked! I must have missed (or mistyped) a character in there somewhere. Anyway, that was a good solution for the images, and since I'm not concerned about search engines, the extra code doesn't bother me.

I like Kendra's solution for having one menu that works on the root pages as well as subdirectory pages; my menu is nested inside a table cell and her solution worked perfectly on every page. It will be great to make updates to the menu and have it replicate across the site (200+pages already and growing!). Thanks again, Kendra, Steve and Ruth! :D
Post Reply