Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:17
Images, Links, Submenus, and Frames - Help!
Poster: webline
Dated: Friday November 15 2002 - 19:03:45 GMT
Hi,
I'm trying to set up a site with a navigation frame along the top of the screen and a content area below it. I want to have drop down menus that appeared below the navigation frame - on top of the content frame. After searching online, I found this site.
I've tried to set up the Milonic scripts, but I'm running into a problem. The main navigation menu is image based and the images change as the mouse is over them using the swapimage property. Also, only some of the main menu items have submenus. The others don't have any submenus.
I've set everything up so that the site looks good and all of the links work in IE, but I'm running into a problem with Netscape. I cannot get the main navigation bar links to show the content of the link in the content frame. If I try and use a target attribute for the link, then the link works perfectly in IE, but in Netscape the link doesn't work at all. If I leave out any kind of target property for the link, the link works in both IE and Netscape, but the page is displayed in the navigation frame, not the content frame.
Any help would be greatly appreciated.
Thanks,
Steve
Poster: trytrix
Dated: Friday November 15 2002 - 22:30:59 GMT
Hi,
As we keep saying ... a URL is always most helpful so we can see exactly what is going on (and also look at your array file).
Cheers,
Trytrix
Link
Poster: webline
Dated: Saturday November 16 2002 - 13:06:06 GMT
The sample site is online at:
http://www.webline-designs.com/projects/webline2
It looks like everything is working fine only in IE on a Mac, not on Netscape on a Mac and not on either on a PC.
On all OS and browser combos, the submenus work and the rollovers work on the main navigation menu, but I can't get the main navigation buttons to work as links.
The scripts are found at:
http://www.webline-designs.com/projects ... s/mmenu.js
http://www.webline-designs.com/projects ... n_array.js
Again, I'm having a problem trying to get the links to pull up content in the content frame. When I put a target attribute in, I get the version you see online. When I take it out, the links work, but they replace the navigation bar, not the content frame.
Thanks for any help you can offer.
Steve
Poster: kevin3442
Dated: Sunday November 17 2002 - 10:05:43 GMT
Hi Steve,
After a quick look, there are a few things I can suggest right away.
(1) In your navigation_array.js and content_array.js files, your plain_style array has only 14 elements. There should be 20. I don't know what overall effect leaving out 6 style elements would have, but I have seen strange behavior before when I forgot just one. Check out the examples on the milonic site to see what other style elements there are.
(2) In a menu array, you only need to use '# ' in a menu item's Main URL field or Alternalte URL field if you don't want to include a real url in the field, but still want to use some of the additional properties in it, like swapimage. In such a case, the # serves kind of like a place holder, so that the menu item doesn't go looking for a link when clicked. Your Home, Development Process, and Contact Us main menu items (i.e., the ones with no submenu) all have this issue. They are all of a structure like this:
Code:
,"<img src=an_image.jpg>","link.html target=content;# swapimage=another_image.jpg;",,"text",1
Try changing them to be like this:
Code:
,"<img src=an_image.jpg>","link.html target=content;swapimage=another_image.jpg;",,"text",1
Notice that the swapimage assignment immmediately follows the target assignment, with a semicolon between.
(3) All of your main menu items that have submenus place the swapimage assignement in the Alternate URL field, as they should. However, you have no semicolon between the target assignment and the swapimage assignment. There should be a semicolon separating each alternate property from the next, and after the last one (which you have). A space after the semicolon is optional.
I can't promise these'll solve everything, but they should get you further along. Hope that helps.
Kevin
Poster: webline
Dated: Sunday November 17 2002 - 14:33:53 GMT
Kevin,
Thanks for the help. I made all of the changes you suggested, but I'm still running into the same problem. All of the submenus links work. All of the swapimages work on the main navigation menu and all of the ones that should drop down submenus do, but the main navigation menu links still do not work. The browsers look like they are loading the file in, but it doesn't appear. I think it's a problem with using a link with a target tag along with the swapimage property.
Am I just running up against a limitation of the Milonic Menus or do I still have some syntax errors?
Also, if it is a limitation, does anyone know of any work arounds? For example, are there some functions I can call to pull the content and display it in the appropriate place?
Is it possible that the name of the content frame is a reserved name? I used the word "content" to name it? Also, I do believe that when I replaced the target=content with target=_top, the link got rid of the frameset and pulled the content up in the whole window. And, when I leave out any target tag, it does pull content up in the frame that the menu is in (the navigation frame). That's why I'm thinking the problem lies in the target tag.
Thanks in advance for any help you can offer,
Steve
Poster: kevin3442
Dated: Monday November 18 2002 - 7:14:58 GMT
Hi again Steve,
Hmmmm... very strange. In response to your questions or concerns: There is not usually a problem using a link along with a target and swapimage property. It should not be a limitation of the menu; the menu is meant to be able to do this. I do the same kind of stuff a lot and have never had a similar problem. Also, I don't believe "content" is a reserved word for frames.
I have a few more suggestions.
(1) The plain_style array in navigation_array.js has a blank line before the closing ]. I don't think this should normally be a problem, but superstition now tells me it might be worth removing.
(2) The plain_style array in content_array.js still has only has 14 elements; should be 20. I've noticed another slight oddity in your menus: Your submenus don't close when you mouse over a different main menu item that does not have submenus, even though Keep Alive isn't on. A submenu does close when another submenu opens (as it should). I noticed a similar behavior in my own menus when my style arrays were short. Other than the above two possibilities, I don't seen any syntax errors in your menu code (not to say some didn't slip past me).
(3) In the navigation frame's navigation.html file, the two menu scripts, mmenu.js and navigation_array.js, are loaded at the bottom of the body. Shouldn't be a problem normally, but I have read of other strange behaviors that seem to be affected by the placement of the scripts. I would suggest making them the first two lines of the <body>. If the order in which your elements appear on screen is the reason for the placement at the bottom of the document, then there are other ways to make the menu appear on screen later in the document loading process (we can tackle that later if need be).
(4) In the content frame's home.html file, the two menu scripts, mmenu.js and content_array.js, are loaded inside of a <div> block. Could you move the two lines that load the scripts so that they occur before the div? Again, I would suggest making these the first two lines of the <body>.
(5) I have limited experience with framesets... I make mine pretty much the same way every time I use frames. So, I don't presume to be an expert on frames. I noticed, however, that the first frame in your frameset is 1 pixel in height. Not odd in itself... maybe you intend it to be a hidden frame where you can do other stuff, store variables, define globally accessible functions, etc.? But, it has no name and its src is index.html (i.e., the file where the frameset itself is defined). You mentioned that the non-working links appear to be loading a document somewhere in the browser, but the document doesn't appear. Could it be that the errant document is actually in the invisible frame? Why not get rid of that frame for now, just to test? If you keep it, how about giving it a name, and have it load a different document, at least for now, to see if that helps the menu problem.
(6) On a lark, I tried this. The link you provided earlier in the thread was: http://www.webline-designs.com/projects/webline2. Using that link, we go to the site and experience the described oddities. I tried this: http://www.webline-designs.com/projects/webline2/index.html. Now the main menu item links work (you don't have a default.html file in there do you... what web server are you running?). I'm not saying I can explain it, I'm just tossing it out there. It does, however, make me think about point number 5 some more, albeit for no reason I can put my finger on.
Keep trying. It'll work! Nice site design by the way.
Kevin
Thanks Kevin!!!
Poster: webline
Dated: Monday November 18 2002 - 12:47:59 GMT
Kevin,
Thank you for your help. As you guessed, the problem was with the frameset. Another developer created the original code and began implementing the Milonic script. Since it was the first time we were using the script, I assumed the problem was there and didn't review the frameset code (as I should have). My guess is that the files were loading in the content frame, but it was the content frame withing the 1 pixel high top frame.
I have not yet made the other corrections you suggested, but will be taking care of them this morning. Hopefully they will fix the error with the menus remaining when the mouse moves to another main navigation element. If not, I think I might have another question for the board.
Thanks again,
Steve
Poster: webline
Dated: Monday November 18 2002 - 18:58:39 GMT
Kevin,
Fixing the frameset did the trick. But, I went ahead and made the rest of the changes you indicated as well. It doesn't look like they had any impact on the site, but I'm glad that the code's been cleaned up a bit.
I am still running into a few problems though:
1) As you noticed, the dropdown menus are not disappearing when I move from a section that has drop downs, to one that does not. For example, the Our Company subsections remain open if I move the mouse from Our Company to Home.
2) The items in the main navigation menu seem to have an additional border between them when viewed in Netscape 4.7. This causes them to push out of the navigation and cause the navbar to look awkward.
3) Ideally, I would like the main menu button to remain highlighted as the user moves his/her mouse into the subsections. And, I would even like it to remain highlighted after the user clicks on a subsection. Only when the user actually clicks on another section or subsection would I like the highlighting to be removed. That way as someone is moving around in the Services section, no matter where they go, Services is highlighted, until they leave for another section of the site. I'm not sure if this is possible.
Anyway, if you could point me in the right direction on all 3 of the issues above, I would greatly appreciate it.
Thanks,
Steve