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:32
tmenu.0 error - lil time sensitive :)
Poster: tam6379
Dated: Tuesday April 22 2003 - 18:12:41 BST
I am using the menu builder to create a menu for my site. When I try to test the menu using the menu builder or when I download the scripts and add them to my site, I recieve the following error on page load...
http://www.somethingmusic.com/
Quote:
Error A Runtime Error has occurred. Do you wish to Debug? Line: 35 Error: 'tmenu.0' is null or not an object
I am not super program friendly, but I am willing to do what it takes to make this work. Everything was going smoothly so a kept updating the menu. Confident, I promised a friend I would provide him with a 'cool' website by 1 May 2003 for his band to keep people coming back and to me this DHTML menu rocks which is why I want it so bad.
Thank you in advance and if you wish, I will add your name or email if you like to our site credits.
Thomas
Poster: kevin3442
Dated: Wednesday April 23 2003 - 4:55:55 BST
Hi Thomas,
Starting on line 60 of your menu_array.js file, you are calling addmenu() to add a menu that (1) has no name and (2) has no menu items defined. That's what is causing the error.
Hope that helps,
Kevin
Update
Poster: tam6379
Dated: Wednesday April 23 2003 - 15:05:01 BST
I removed the following code since I do not need another menu there...
Code:
addmenu(menu=[
, // Menu Name - This is needed in order for this menu to be called
, // Menu Top - The Top position of this menu in pixels
, // Menu Left - The Left position of this menu in pixels
144, // Menu Width - Menus width in pixels
0, // Menu Border Width
, // Screen Position - here you can use "center;left;right;middle;top;bottom" or a combination of "center:middle"
SomethingNew, // Properties Array - this array is declared higher up as you can see above
0, // Always Visible - allows this menu item to be visible at all time (1=on or 0=off)
, // Alignment - sets this menu elements text alignment, values valid here are: left, right or center
"fade(duration=0.5);", // Filter - Text variable for setting transitional effects on menu activation - see above for more info
0, // Follow Scrolling Top Position - Tells this menu to follow the user down the screen on scroll placing the menu at the value specified.
0, // Horizontal Menu - Tells this menu to display horizontaly instead of top to bottom style (1=on or 0=off)
0, // Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on or 0=off)
, // Position of TOP sub image left:center:right
, // Set the Overall Width of Horizontal Menu to specified width or 100% and height to a specified amount
0, // Right To Left - Used in Hebrew for example. (1=on or 0=off)
0, // Open the Menus OnClick - leave blank for OnMouseover (1=on or 0=off)
, // ID of the div you want to hide on MouseOver (useful for hiding form elements)
, // Background image for menu Color must be set to transparent for this to work
0, // Scrollable Menu
, // Miscellaneous Menu Properties
])
, // Menu Name - This is needed in order for this menu to be called
, // Menu Top - The Top position of this menu in pixels
, // Menu Left - The Left position of this menu in pixels
144, // Menu Width - Menus width in pixels
0, // Menu Border Width
, // Screen Position - here you can use "center;left;right;middle;top;bottom" or a combination of "center:middle"
SomethingNew, // Properties Array - this array is declared higher up as you can see above
0, // Always Visible - allows this menu item to be visible at all time (1=on or 0=off)
, // Alignment - sets this menu elements text alignment, values valid here are: left, right or center
"fade(duration=0.5);", // Filter - Text variable for setting transitional effects on menu activation - see above for more info
0, // Follow Scrolling Top Position - Tells this menu to follow the user down the screen on scroll placing the menu at the value specified.
0, // Horizontal Menu - Tells this menu to display horizontaly instead of top to bottom style (1=on or 0=off)
0, // Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on or 0=off)
, // Position of TOP sub image left:center:right
, // Set the Overall Width of Horizontal Menu to specified width or 100% and height to a specified amount
0, // Right To Left - Used in Hebrew for example. (1=on or 0=off)
0, // Open the Menus OnClick - leave blank for OnMouseover (1=on or 0=off)
, // ID of the div you want to hide on MouseOver (useful for hiding form elements)
, // Background image for menu Color must be set to transparent for this to work
0, // Scrollable Menu
, // Miscellaneous Menu Properties
])
Now when I load the webpage, I get the error message...
Quote:
Line: 1 Error: Syntax Error
Which line 1 in the menu_array.js file is...
Code:
menunum=0;menus=new Array();_d=document;function addmenu(){menunum++;menus[menunum]=menu;}function dumpmenus(){mt="<scr"+"ipt language=JavaScript>";for(a=1;a<menus.length;a++){mt+=" menu"+a+"=menus["+a+"];"}mt+="<\/scr"+"ipt>";_d.write(mt)}
Thanks again for the help and for future help.
Poster: kevin3442
Dated: Wednesday April 23 2003 - 17:59:57 BST
Thomas,
It seems that whatever you used to edit your files has drastically changed the menu_array.js file; adding various html tags and replacing your double quotes with ". I see that you use FrontPage 5.0 to make your site. I'm guessing that you loaded your .js file into FrontPages' built-in page editor? That's a wysiwyg editor that treats what you see as if your want to format it for display on the page. In other words, the editor has added html tags to format the text of the code for display on a webpage, rather than treating it as code that you want to run. I noticed that this has happened to your mmenu.js file as well. .js files should be edited and saved as plain text. Notepad suffices, but there are several text editors available -- many for free -- that do syntax coloring, auto indenting, etc. to make code editing easier. I use ConTEXT, but I know that there are several others available; maybe worth doing a web search to find one you like. In any case, you shouldn't edit your .js files in FrontPage's page editor.
So, what to do now? (1) Replace mmenu.js with a fresh copy (download it again from Milonic if you have to). (2) Get rid of the html stuff in your menu_array.js. That'll be a pain, and it might be difficult to get all of it out. If you don't have your own backup from before the change, then you're still in luck... When I looked at your site yesterday to see what was going on, I saved a copy of your menu_array.js file locally, so I could test what I thought to be the problem. I still have that copy, with the original problem solved. I've zipped it and put it on our web server, so you can download it. Let me know when you have it, or if you don't need it, so I can remove it from our server.
Kevin
It worked!
Poster: tam6379
Dated: Wednesday April 23 2003 - 19:12:46 BST
Wow - I can't thank you enough for the thourough help you provided. I followed your instructions (btw conTEXT is awesome) and my menu is running!
Thank you thank you thank you - you definitely saved me!
PS - thank you for offering a copy of the menu - it saved me a lot of time!