Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: JavaScript Error: MENU_ITEMS is Undefined
Snowman
Junior Member

Posts: 3
Registered: 12/8/2003
Member Is Offline
posted on 12/8/2003 at 01:40 AM
JavaScript Error: MENU_ITEMS is Undefined


Ive installed the menu script into an oscommerce site and i cat seem to get it to work.

I constantly get an error saying that MENU_ITEMS is undefined.

any ideas as to what may be causing this???
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 12/13/2003 at 03:03 AM

This kind of error is reported when JavaScript tries to use the variable which is not correctly defined. Possible reasons of the problem are:

1. Name of the variable in configuration file is different from the name of variable passed to menu constructor. I.e. you have MENU_ITEMS1 in menu_items.js file but MENU_ITEMS2 in new menu statement in HTML file

2. File is not linked correctly to the page so JavaScript can't see that variable. I.e. you link to menu_items1.js and structure is defined in menu_items2.js or you link to menu_items.js and file is actually at /javascripts/menu_items.js or file is in the directory with limited or no access allowed. Check web server's log file for broken links reports (response status 404) or access denied (response status 403)

3. There is syntax error in items structure definition i.e. string(s) are not quoted properly, missing or extra brackets, missing or extra commas, etc. To check if problem is caused by syntax error comment out menu initialization ('new menu' statement) but leave configuration files linked. If you still receive JavaScript error then you should check the syntax of configuration files.

Now about your particular case: I've removed all responses from this thread as they don't lead to the solution. Maybe it's rude but I prefer to save readers from confusing reading. HTML errors can cause the problems but they don't result in 'variable is undefined' errors. I've checked the structure you provided with working script configuration and it is errors free (having empty strings for menu items is not the best idea though) so it's not condition 3. Variable names seem to be identical so it?s also not condition 1. So what's left is condition 2 - check if file is on the server, linked properly and can be accessed by the browser.
View User's Profile View All Posts By User U2U Member
Snowman
Junior Member

Posts: 3
Registered: 12/8/2003
Member Is Offline
posted on 12/13/2003 at 03:37 AM

thanks for all the great help ive gotten so far. The only reason i have empty strings is because they sit over the buttons images i have on the site.

Well at least that was the theory.

I created a duplicate of the index.php page and called it index2.html and removed all unrelated html from it and the menu indeed works, so i know im linkin to it properly.

I will have to assume that it doesnt work because of the fact that the page displayed is built using php includes. Its the only explanation i can come up with that could explain it.

Ive been right thru my html and error checked it and apart from missing alt"" tags on images there are no errors.

I must mention that on another oscommerce website i use the menu in the header, but i found that i had to place the javascript in the header include file rather than at the bottom of the page to get it to work in that instance... Ive tried that on this one as well but it made no difference.

Im out of ideas... any further suggestions?
View User's Profile View All Posts By User U2U Member
Snowman
Junior Member

Posts: 3
Registered: 12/8/2003
Member Is Offline
posted on 12/13/2003 at 04:04 AM

Ah Found the problem :)

because i had the top level of the menu strings empty it wasnt displaying on the php page.

which is weird cause it worked by itself on the test page i did.

I added text to the top levels of the menu and low and behold there it was...so for some reson it requires text on the top level to work in oscommerce

Thanks for all your help :)
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page Tigra Menu
Product Demonstrations Live Demos:
Traditional Blue
White Steps
Inner HTML
All Together
Frames Targeting
Free Download Free Download
Free Download Menu Builders
Online Builder
Builder for Windows
Product Documentation Documentation:
Documenation Page
Change Log
Menus Comparison Table
Support Forum Support Forum
 
Tigra Menu PRO
Product Demonstrations Live Demos
Alignment & Multimenus
Unlimited Depth
Item sizing and positioning
Inner HTML
Frames, Targeting
Static Positioning
Free Download Menu Builders
Online Builder
Product Documentation Documentation
Documenation Page
Tigra Menu PRO FAQ
Change Log
Menus Comparison Table
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 
Product Page Tigra Menu GOLD
Functionality demos Functionality demos
Multiple
Cross-framed
Select-boxes
Effects
Design demos Design demos
Icons & arrows
Idea!
Hi there!
Matrix
MS Style
XP Style
Dots
3D-Buttons
Product Documentation Documentation
Documenation Page
Change Log
Menus Comparison Table
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004