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: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Thursday February 8 2018 - 06:02:39

Single quote break "Status" text

Poster: blimey
Dated: Tuesday August 13 2002 - 16:01:04 BST

When a single quote is inserted into the Status for a menu item, an error occurs immediately when the page is loaded. This breaks for me using IE6, but doesn't break with Mozilla 1.0.

This is easy to reproduce, get the standard and in menu_array.js change

,"Home","",,"Back to the home page",1 // "Description Text", "URL", "Alternate URL", "Status", "Separator Bar"


,"Home","",,"Back to the 'home page'",1 // "Description Text", "URL", "Alternate URL", "Status", "Separator Bar"

Error is:

Line: 20
Error: Expected ')'

Poster: John
Dated: Tuesday August 13 2002 - 20:37:52 BST

Don't you have to escape the silly thing... :?:

\'home page\'

Think that's it (working from home today - brain is still in bed :!: )

Poster: blimey
Dated: Wednesday August 14 2002 - 0:13:08 BST

I believe the string literal in my example is syntactically correct as JavaScript.

Using the escape sequence as suggested to construct the menu_array would give the same results because it would represent the same string. As it happens, I did post both cases before making my original post.

FYI: the use of the escape sequence \' is optional in this case, since I have used double quotes to enclose the string literal. If they were required, then this URL would also error: javascript:alert("O'Reilly");

I strongly believe this is just a case which the Milonic menu just can't handle currently. My current work-around is simply to have no status text for these exceptional cases - this is clearly not ideal.

I look forward to this being acknowleged as a bug with mmenu.js and ultimately being fixed!

Poster: Andy
Dated: Wednesday August 14 2002 - 11:27:50 BST

Try double escaping the apostrophe.

Code: Select all

,"Home","",,"Back to the \\'home page\\'",1 // "Description Text", "URL", "Alternate URL", "Status", "Separator Bar"

Poster: blimey
Dated: Wednesday August 14 2002 - 21:07:40 BST

I can understand how that would compensate for the bug in mmenu.js, but I would rather see this fixed in mmenu.js than use this work around. While what you've suggested may solve the problem, it seems like a kludge to me and just doesn't seem "right" long term.

Should I assume that you don't intend to fix this bug and that I must use this work around (for ever)? Or alternatively, should I assume that you will fix it at a later date, and that upgrading to a new mmenu.js might make my code incompatible?