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: Saturday July 14 2012 - 06:07:34
Mmenu.js errors with Netscape
Poster: spraine
Dated: Wednesday February 19 2003 - 17:02:01 GMT
Hi Kevin--
Receiving Netscape errors as follows:
I am getting this information from Netscape:
JavaScript Error: http://our.homewithgod.com/spr/mmenu.js, line
451:
_d.layers[mnu] has no properties.
JavaScript Error: http://our.homewithgod.com/spr/mmenu.js, line
451:
_d.layers[mnu] has no properties.
RE http://our.homewithgod.com/spr/
Sure would like to get this fixed.
Thanks,
Steve
Poster: kevin3442
Dated: Thursday February 20 2003 - 9:49:28 GMT
Hi Steve,
I'm looking. The only thing I've noticed so far is that you have a bunch of stuff at the bottom of menu_arra.js (scoll all the way down) that seems to partially duplicate code higher up; same menu names, style array names as earlier. You might want to delete all of that; up to but not including dumpmenus().
Kevin
Poster: John
Dated: Thursday February 20 2003 - 14:14:22 GMT
In addition to what Kevin mentioned (duplicate menu names but different properties within the array file, etc.), I see the following...
Move the JS menu calls from the head to the body.
Way too much white space in your array file - wasted, time consuming. In many cases I see in excess of 25 lines for a simple comment where just 1 would do the trick.
Some of the items in your styles appear to be out of place. You have...
Code:
,"FFFFFF" // Menu Header Font Color (Leave blank if headers are not needed)
,"000000" // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
,"000000" // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
The comma should be on the end of the item...
Code:
"FFFFFF", // Menu Header Font Color (Leave blank if headers are not needed)
"000000", // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
"000000", // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
The way you have it now, the 'ffffff' would not apply to the menu header font color as the comment suggests, but rather to the next item, which is menu header background color.
I see just a bit of a travelling menu off-screen to the bottom. When I scroll down to try and see it it just moves down off-screen again.
My guess is you're trying to use one array to make 3 different menus. Don't. Use 3 individual files. Note Andy's comment in the array that eludes to this...
Code:
The above also needs to be enabled if it not already enabled unless you have more than one _array.js file
Constructive comment? Slow down, don't try to do too much at once, check your coding, and get rid of the riff-raff.
Poster: spraine
Dated: Thursday February 20 2003 - 16:09:59 GMT
OK--
POINT 1:
So...
CORRECT = "Biographies","show-menu=Biographies",,,1,
WRONG = ,"Biographies","show-menu=Biographies",,,1
POINT 2:
An earlier comment from one of you suggested putting all 3 menus in one file.
What are pro's and con's of each technique?
POINT 3:
Moved memu_array.js and mmenu.js from Head to Body.
POINT 4:
RE lower horizontal menu traveling off screen at the bottom--
Bottom menu is set to stay at the bottom.
I had some js which set the page size per viewer screen (code still there, but 'commented out'), but a friend HATED what it did on her screen, so I disabled it.
John--is your monitor lower edge adjusted slightly too low?
POINT 5:
I'll clean up the code.
VERY appreciative of your feedback.
Definitely moving in the right direction.
Thanks,
Steve
Poster: John
Dated: Thursday February 20 2003 - 16:47:59 GMT
Hi Steve -
#1.
Yes. Note that you have all your other items correct. I suspect you just made the error somewhere and then good old copy/paste moved it around (got trapped in that myself yesterday!). Remember the only errors I saw were as described in my last post.
#2.
I suppose you could put everything in one file, but to me that just makes it more difficult to keep things straight. As Kevin pointed out, in your case you are defining the same names (e.g., 'mainmenu') in more than one place in the same file. No can do. However, mainmenu2, mainmenu3, etc., would be OK. There can be NO duplicate names in a single file operation!
If you go to a single file for each menu your calls would look something like this...
Code:
<script language="JavaScript" src="/sai/templates/menu_array.cfm" type="text/javascript"></script>
<script language="JavaScript" src="/sai/templates/menu_array2.cfm" type="text/javascript"></script>
<script language="JavaScript" src="/sai/templates/menu_array3.cfm" type="text/javascript"></script>
<script language="JavaScript" src="/sai/templates/mmenu.js" type="text/javascript"></script>
<script language="JavaScript" src="/sai/templates/menu_array2.cfm" type="text/javascript"></script>
<script language="JavaScript" src="/sai/templates/menu_array3.cfm" type="text/javascript"></script>
<script language="JavaScript" src="/sai/templates/mmenu.js" type="text/javascript"></script>
In this case, calling each menu 'mainmenu', etc., would be perfectly fine. Different scripts, therefore no conflicts. Don't forget to remove the 'MUST APPEAR ONLY ONCE' line of code from array2, array3, etc.
#3.
OK.
#4.
Doesn't matter how I size my window or where I scroll. The bottom menu always travels down (painfully slowly) so that less than half its height is visible. Again, suspect it's probably a name conflict in your single page coding.
Poster: spraine
Dated: Thursday February 20 2003 - 20:02:06 GMT
Hi men--
Well...
Changing from
,"Biographies","show-menu=Biographies",,,1
to
"Biographies","show-menu=Biographies",,,1,
is no good. Get error messages.
How about...
Start with:
,
,"Biographies","show-menu=Biographies",,,1
and change to
,
,
"Biographies","show-menu=Biographies",,,1,
Changes made no far still haven't resolved the menus not showing up on Communicator 4.7.
The hunt goes on,
Steve
Poster: John
Dated: Thursday February 20 2003 - 20:44:52 GMT
Quote:
Changing from
,"Biographies","show-menu=Biographies",,,1
to
"Biographies","show-menu=Biographies",,,1,
is no good. Get error messages.
,"Biographies","show-menu=Biographies",,,1
to
"Biographies","show-menu=Biographies",,,1,
is no good. Get error messages.
Yep, you would. It was right the way it was (that's not one of the items we mentioned as being wrong - although I see you brought it up in your last message).
The problem I called out...
Code:
,"FFFFFF" // Menu Header Font Color (Leave blank if headers are not needed)
,"000000" // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
,"000000" // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
...which should be...
Code:
"FFFFFF", // Menu Header Font Color (Leave blank if headers are not needed)
"000000", // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
"000000", // Menu Header Background Color (Leave blank if headers are not needed) 6f738b/
...is in your Hdr1Style definitions (which you have more than one of).
Poster: kevin3442
Dated: Thursday February 20 2003 - 21:14:29 GMT
Hi Steve, John.
Thought I'd throw in my own two cents.
Point #1 - Nice catch on the style arrays John. That might explain alot. It is an easy one to slip by. However, Steve, I'd say that, in the example you gave in your reply to John:
Quote:
CORRECT = "Biographies","show-menu=Biographies",,,1,
WRONG = ,"Biographies","show-menu=Biographies",,,1
WRONG = ,"Biographies","show-menu=Biographies",,,1
the method you've labeled "correct" above is not necessarily the way to go. It's true that, for most purposes, the method you've indicated as "correct" is the standard approach for assigning multiple values to arrays, as John pointed out... sort of like 'value - comma - value - comma - value'. This is the preferred method most of the time, as with your style arrays. However, as you'll see in all of the on-line examples and in almost every implementation of Milonic menus (at least the ones I've seen), the most common practice for defining a single menu item within an array is:
Code:
,"Item Text","URL","Alternate URL","Status Text",Separator
Just like your
Code:
,"Biographies","show-menu=Biographies",,,1
Although this is non-standard, and may even look strange at first, it is neither "wrong" nor "right", as long as you have the correct sequence of values and commas in the preceding assignments to the same array. This method -- starting each item definition line with a comma -- is much more convenient because it makes it a lot easier to insert new menu items, delete existing ones, or change the order of items within a menu; you just add a new line, delete a line, or move entire lines around. If you use the method labeled "correct" above, it becomes a real pain, primarily because of the comma at the end of the line.
Point #2 - I suggested moving your menus into one array file. That's how I do it when dealing with multiple "main" menus on a page. I take the approach that any menu that'll be available on all pages will be defined in one .js file. I've tried it both ways, and decided that it was easier for me to manage my menus this way. I've never run into a problem. A menu array .js file typically contains many menu arrays anyway. "Main" menus are pretty much the same as submenus; the only significant difference is that a "main" menu has Always Visible turned on and a submenu doesn't. To me, that doesn't present a big enough difference to warrant separate files. Steve, you asked for advantages and disadvantages of these approaches. Here they are, as I see them:
One-file approach. Advantages: (1) All menu code in one file - seems easier to me, but some may find that it's better to have multiple, smaller files. (2) Fewer files to manage, seems easier to me. (3) Potentially less editing of other files in the long run; i.e., If you want to add another main menu at some later date, and you put it in a separate file, then you have to src that file into every document where you want to use the new menu. This may require a lot of repetitive editing of .html files -- or maybe not, if your menus are in SSIs, shared borders, etc. Just depends on your site structure I guess). But no matter how you slice it, if your menus are all in one file, you can simply add another one to the file and it will appear on any page that already sources that file; no editing of other .html files. (4) Fewer potential problems with duplicate array names, in my opinion. I think that the one-file approach is actually better on this score. True, a duplicate style array or menu array name will have different consequences if they're in the same vs different source files, but if you do make such an error with the single-file approach, it will become apparent pretty quickly (i.e., like when you were trying to edit a menu, Steve, and it seemed as if you weren't able to change it). Also, I don't think this should really be an issue, as long as you name your arrays carefully, using meaningful names (i.e., not like "style1"). Disadvantages: I really can't think of any, at least none that I have encountered.
Multi-file approach. Advantages: (1) Some people may find that this is a better organizational scheme; one file per main menu. As long as your files are descriptively named, it shouldn't be a problem remembering which file contains which menu defintions. Disadvantages: (1) You have to remember to comment out or remove that one line of code at the top of a "template" menu array file. If you forget, errors ensue and some menus will refuse to appear. (2) Related to that, I've learned that the .js file that contains that one important line must be the first one sourced into the .html file. If it isn't, then any .js menu array files preceding the one containing that line will be "ignored" (its main menu will not appear). (3) Duplicate naming of menu arrays and style arrays across multiple files does have an impact and, to me, may be more difficult to detect and have stranger consequences. True, you can have two menu arrays named the same thing in two or more different files. The problems occur mostly for submenus. Suppose the two submenus are named the same but end up having slightly different content. Only one will be used; the one that is encountered after that all-important top line of code (I think!). Also, consider style arrays in different files, but having the same name. Interestingly, the style array that's within the scope of the file will be used for any menu in the same file whose Always Visible property is on. But those would be "main" menus. Once again, the problem is with submenus. If you apply a style array name to a submenu (even if that style array is defined in the same file as the submenu), then the style array will be ignored if the same style array name is used in a file that was src'd earlier in line, and if that earlier src'd file also has a submenu of the same name. I hope that made sense... it barely does to me. It seems like the system will use the first variant of a style, so long as that variant occurs after the all important top line of code. I can't swear that this is a hard and fast rule, just an impression. Anyway, I'm rambling on... I guess the point is that I think the potential for oddities resulting from duplicate array names is increased by having multiple files, especially for people who do alot of cutting and pasting when building menus (and don't we all?). Of course, this can all be avoided by avoiding duplicate array names outside of functions in the first place!
Really, with the one- vs. multiple-files approach, I think it comes down to what you're most comfortable with. Neither is right nor wrong, and each has its own potential pitfalls. As with anything, it boils down to the fact that it all has to be coded correctly to make it work!
Point #3 - Just as a matter of interest... the only reason left, as far as I know, for putting the menu scripts in the body rather than the head is because some (all?) versions of Opera have problems if the scripts aren't loaded in the body. I think all other browsers can now handle it either way. Of course, if you want your site to work reliably in Opera, you'll load the menu scripts in the body.
Point #4 - I get the bottom menu traveling below the bottom border (as soon as the page loads) in NS7 and Opera 6.05 on Win2k. I don't get this behavior in IE6 in Win2k or IE5 in Win98. Further, in Opera 6.05, if I resize the browser window, all of the menus disappear entirely, never to return (unless I reload). And there are still problems getting the page to display in NS4.7x. Maybe some of this will be resolved when the code is tightened up.
Additional Points. Steve, from my own point of view, it occurs to me that your menus could be simplified/combined. Right now, you've got main menus on three sides. Even when maximized at 1024x768, only about 50% of the browser's content area is available. The other 50% is occupied by banners, tickers, and the menus. This is in IE6, with small buttons, which I find usually offers a slightly larger content area than other browsers. So, the amount of available space will be even less in some browsers, and the percentage will decline with decreased screen resolution. That doesn't leave you a lot of room for stuff on a page! You might consider the philosphy that navigation controls should take up as little space as possible, while still being obvious, easily accessible, and consistent in appearance and function from page to page. That's one of the great thing about these menus; you can pack the entire site's navigation into an easy-to-use set of menus that branch off of a fairly inocuous main menu or two, leaving more space for site content. SO, if you don't mind me saying, I'd humbly suggest that you try to reduce the main menus to one or two; top and/or left. this may even decrease the number of headaches!
Man... when I get going I type way too much. There goes my whole lunch break! And my keyboard has crumbs all over it now!
Cheers,
Kevin
Poster: John
Dated: Thursday February 20 2003 - 22:52:00 GMT
Jeez - you call that two cents
Interesting you are not seeing the bottom menu error in IE6. That's exactly where I do see it, but I'm on XP (wonder what that has to do with it?).
Other than that, I pretty much agree with most of your observations (maybe one or two advantages/disadvantages we could get into ).
Bottom line is the array needs to be cleaned up and the duplicate names in there fixed.
Now - where the heck is my Excedrin...
Poster: spraine
Dated: Thursday February 20 2003 - 23:03:06 GMT
OK--
Please check this monstrosity on Netscape 4.7x now.
Eliminated all the extra Hdr Style sections.
Don't want to do anything with the "tri-fold" design right now...
I like it. (plus, for now, stuck with web provider ad on top right).
I DO appreciate your corrections, comments, and suggestions.
Puzzled about the bottom menu dropping off the screen. I've got the coding set to "dwell" at the bottom. Hmmm...
Heck, you guys didn't really want a life anyway, right?
Leaving fast!
Steve
Poster: John
Dated: Thursday February 20 2003 - 23:10:58 GMT
NS 4.79 - I'm getting an error on the Applet - 'Bad major version number' (whatever that is). No menus showing at all.
Do you really need that scroller? Even with just a few graphics and the menus, when the page does load it takes almost 20 seconds! Think what will happen when you get content in there. Cleaning up the array will help quite a bit, but I think the applet is the killer. Why not try taking it out for a while to see what happens? Just a thought...
Poster: kevin3442
Dated: Friday February 21 2003 - 0:38:19 GMT
jgillett wrote:
Jeez - you call that two cents
Well... OK... inflation... call it 5 cents
Steve,
The bottom problem has disappeared for me in NS7 in Win2k. Last time, with Opera 6.05 in Win2k, the bottom menu started out cut off. Now it appears fine in Opera, but when I resize the window, all of the menus still disapper. If I start out with a short window, so that I can scroll vertically, the bottom menu appears in the correct place when the page loads, but it does not follow scrolling (does not remain at the bottom). NS4.75 still will not load the page (same error message as before).
The Opera thing got me thinking again about your menu layouts. If a visitor to your site has their browser window's height at about 550 or so (depending on which browser), then your "Request Form" menu will overlap the bottom of your side menu. I can think of a couple of approches to dealing with that, but that may be something for later discussion.
Kevin
Poster: spraine
Dated: Friday February 21 2003 - 0:52:44 GMT
Hi Kevin--
I've added "Request Form" to the bottom Menu. (so 3 Menus now instead of 4)
Trying to decide what to do with the left one. Trouble is, I intentionally laid out the format.
I'm clueless as to the Netscape 4.7x problem. I know one person told me that "generation" didn't support dhtml, but...?
Does this page REALLY take 20 seconds to load?
Steve
Poster: spraine
Dated: Friday February 21 2003 - 1:13:00 GMT
Hi guys--
The top left picture is coded in the HEAD.
Could that be screwing up Netscape?
Steve
Poster: spraine
Dated: Friday February 21 2003 - 21:58:15 GMT
Received more feedback from a friend...
Here's what I got with Communicator 4.61:
JavaScript Error: http://our.homewithgod.com/spr/mmenu.js,
line 451:
_d.layers[mnu] has no properties.
and looking at the source, I see:
<LAYER z-index=29 visibility=hidden bgColor= id=menu1 top=200
left=14 width=120>
and the wysiwyg view-source page has it highlighted such that it
apparently is interpreting "id=menu1" as the value for "bgColor"...
there are other layers with similar problems with the bgcolor =
top=10 or whatever... but this first one is breaking the ID attribute
which is critical.
Try setting your background colors in the script and see if it works.
I'll play with this a little and see what happens.
Steve
Poster: John
Dated: Monday February 24 2003 - 14:04:56 GMT
Yes, it really takes (took) about 20 seconds to load. Down to around 10 seconds now in IE - no lie.
Opened up first in IE6. The bottom menu was still half off-screen. When I scrolled vertically it moved up and appeared to lock itself in place where it is now fully visible (unless you shorten up the window - it does not move). The top menu now overlays the picture you have added on the right side.
NS7 is basically the same. Bottom menu still half off-screen. However, if you scroll down to try and see it the silly thing just scrolls further down to maintain its half-off position. It never does return to a fully visible position. Top menu overlays the new picture. Page appears on-screen in about 10 seconds, but the "N" activity thing keeps on truckin' for another 10-15 seconds. No idea what it's looking for.
NS4.79 is back to about 20 seconds load time. Bottom menu is 99% visible and moves to keep the same relative position on a resize. Right picture is still overlaid by the top menu.
Interesting that NS4.79 would not show me the full source code. Had to go to IE or NS7 to see it all.
Just as an aside...
That img tag should not be in the head area.
Always quote all items in your HTML; e.g., table CELLSPACING=0 CELLPADDING=0 border=0 should be table CELLSPACING="0" CELLPADDING="0" border="0", etc. Not saying that's the problem here, but it will come back to get you as the new standards start to be enforced.
Your meta tags will but you nothing as far as the search engines are concerned. Get keywords on your content in there.