Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:21

Debugging the Menu

Poster: SkyFlyer
Dated: Wednesday June 30 2004 - 6:34:55 BST

I guess this is more of wish than anything.
It would be nice to get a line number when there is a problem.
I don't know if this is possible in JS.
I made a bunch of changes a while back and now the menu doesn't show at all.
I know, I should make small changes, test it, and back it up.
Problem is, it was a few weeks since I made the changes and now can't remember what I changed.
I'll comment out code until I find it!
It would be nice to be able to set a debug switch/option and give it would give us an idea of what line the problem is on.
Sorry, I don't have the menu up on the Internet.
I really like working with this menu.
Any thoughts on troubleshooting?
Thanks in advance for the help.

Poster: Andy
Dated: Wednesday June 30 2004 - 11:10:22 BST

Hi Bob,

If the menu is unavailable, you can send us a copy of your menu_data.js file.

We can then run this through our testing procedure to find the problem.

With regards to line numbers. JavaScript does include the ability to view error messages along with the line number that the error message refers to but you may need to switch this feature on in your web browser.

By default this option is off and the error message will appear in a little box in the left hand corner of your web browser (assuming Microsoft Internet Explorer) the image should look like this:


you can double click the exclamation triangle image to see the error message, you'll then get an error message like this


Note that you can turn on JavaScript errors so that they appear whenever an error occurs. This can be a little annoying when visiting a website that has many errors, especially websites that have errors for onMouseOver events and onMouseOut events but it will ensure that you'll see these errors on your own website.

The way to switch errors on is either by clicking the "Always display this message when a page contains errors" check box or you can do it through Internet Explorer settings. To toggle error messages in Internet Explorer, open the Tools menu, then select Internet Options. Then open the Advanced tab and under the Browsing branch, check or un-check the "Display a notification about every script error". This will allow you to see error messages when they appear.

Please note that some JavaScript error messages may give incorrect line numbers. The reason for this is due to the way you are declaring your JavaScript. If you use .js files, the line number is normally correct but you may need to know which file the error has been fired from, this can cause a few problems if you use several .js files. Also, if you have used both .js files and inline javaScript the HTML may throw the line number out. Adding plenty of javaScript alerts with alert("Error is here") will help you track the location of any JavaScript problems

Hope this helps

Debugging the Menu

Poster: SkyFlyer
Dated: Wednesday June 30 2004 - 15:36:30 BST

Thank you Andy.
I feel honored getting a response from you!!!!
I'll give it all a try.

How and where would I send the Menu JS if I did?

Thanks again ...

Poster: Andy
Dated: Wednesday June 30 2004 - 15:56:28 BST

You can email it to menusupport at


Poster: John
Dated: Wednesday June 30 2004 - 18:02:57 BST

If you'd like, Bob, you can also post it here. That way we can all take a shot at it.

Don't forget to use the [code][/code] tags here.

Poster: SkyFlyer
Dated: Thursday July 1 2004 - 6:17:42 BST

I'd be glad to post some code.
However, it is quite large.
I have a number blank lines to help separate things while I develop, plus comments, it is 700 lines or so.
Is this excessive, or are there menu_data files larger?
I don't want to load up the forum with page after page of code!
The error that is showing up is 'mainmenuStyle' is undefined in my index.htm.
I have double checked the spelling.
I'll keep looking and maybe I will have to send it in.
I do have a small amount of web space on Comcast.Net. But I don't know how to post it there so you could see it.
I'll keep playing with it and maybe in a day or so send it your way.
Thanks for the help ...

Poster: Ruth
Dated: Thursday July 1 2004 - 6:27:39 BST

If you had enough space there, you could just upload the file and drop a link for it, then John could just go get the file.


Poster: Andy
Dated: Thursday July 1 2004 - 8:47:56 BST

You've checked the spelling but have you checked the case? JavaScript is case sensitive and the variable 'mainmenuStyle' is completely different to 'mainMenuStyle'

It's just a guess but it could be the answer


Poster: SkyFlyer
Dated: Saturday July 3 2004 - 20:40:51 BST

OK, Happy 4th of July weekend to all of the USA folks.

I've this menu messed up pretty good now.
I might need to start all over!!
It still craps out at mainmenuStyle undefined.
It has to be something stupid on my end!
I think I have the spelling checked out.
I would appreciate some direction on debugging this thing.
It used to work!
Lessons learned:
Don't make too many changes before saving and testing.
Also do backups before changes.
Thanks for any help.
Main page is index.htm
JS stuff is in JS folder
Anthing else needed? Let me know.
Thanks again ...

Poster: Ruth
Dated: Saturday July 3 2004 - 21:42:29 BST

You have errors in you menu_data.js file that are causing the problem.

Somewhere around line 266 & 268 you have
aI("text= ;url=;"itemheight=4);
In both places this should be
aI("text= ;url=;itemheight=4;");

In the following there a /* sitting at the end of the menu before the }
with(milonic=new menuname("freemangalleryMenu")){

aI("text=Under Construction;url=");

aI("text=Freeman Info;url=");
aI("text=Kite Gallery;url=");
aI("text=Paper Models Gallery;url=");
aI("text=Misc Gallery;url=");
aI("text=Some favorite Links;url=");
aI("text=Contact:<br>John & Marzlie<br>Freeman;url=marzlie __at__");
aI("text=Guest Page;url=");


Remove the */ With those corrections the menu works.


Poster: SkyFlyer
Dated: Saturday July 3 2004 - 22:08:35 BST

Thanks Ruth.
How did you find it so fast?!!
You are good.
Yes it is working and thanks to all of you for helping.

Poster: Ruth
Dated: Saturday July 3 2004 - 23:02:21 BST

I use IE with the script error function left on, then check to see if there is a line number x and if there's an error [sometimes I have to look above and below because the line numbers can be off by one or two. Usually, if there is and it's fixed then any of the really high number errors like line 20 char 1895 also disappear.