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:25
Problem using javascript:myfunction() syntax in primary URL
Poster: speedphreak
Dated: Tuesday July 15 2003 - 20:48:19 BST
I used the syntax "javascript:myfunction()" as the URL to get javascript to run from the menu which works fine.... IF it's the secondary URL. Used as a primary URL, the menu doesn't see the MouseOver & change color, and disappears. If you click on the item quickly enough it will run the javascript, but the menu behaves as if there is no link there to click. Is there anyway to fix this... I've been experimenting with using "#" or "" as the primary URL, along with a few other things... please let me know if you have any ideas. If you'd like to take a look at the behaviour let me know, and I'll post a link. THanks for the help!
Poster: kevin3442
Dated: Friday August 1 2003 - 7:12:45 BST
Lemme guess... you're passing literal strings to your function???
I have seen exactly the same behavior you describe... occurring only in top level menus (or perhaps in any Always Visible menu... never tested that theory though). I found that I only saw that behavior if I passed one or more literal strings as parameters. Numeric parameters do not cause the effect. I have a habit of using single quotes around literal strings if they are already inside of double quotes, as is the case with a menu item definition. That won't work in a menu item at the top level, not even if you escape the single quote. What I found will work is using escaped double quotes around literal string parameters.
Hope that helps,
Kevin