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:52
JavaScript function - return false;
Poster: arkeo
Dated: Tuesday March 1 2005 - 21:01:27 GMT
I've looked everywhere and can't find an answer to this question. However, as soon as I post this, I'm sure I'll find it somewhere. (Is there a way to delete posts? )
When calling a JavaScript function with clickfunction=, onfunction=, offfunction=, etc., how do you specify "return false"? I have a stylesheet switching menu that I'm working on (which you probably already know if you've read my other posts) that worked fine in version 3, but I'm having trouble establishing the same functionality in version 5. The reason I'm even migrating to 5 on this site was because it's easier to relatively position on the page.
When the menu drops down and the user clicks an option, the stylesheet changes and the user can see the page change. In FF it works fine. The menu stays open and allows the user to select another option and doesn't close until the mouse actually leaves the menu area. In IE6, however, the page reloads everytime an option is clicked. I was going to try adding a return false to the clickfunction, but can't figure out how to do it, since it requires another semi-colon. Am I looking in the wrong place? Does anyone know how to accomplish this? You can see the current version at http://www.icapsvitamins.com
Poster: Ruth
Dated: Tuesday March 1 2005 - 23:39:45 GMT
I don't see the Milonic menu on that page, so I'm assuming that's what you want it to do, is what's happening there. Do you have a test page so we can see what the problem is with the menu?
Ruth
Poster: arkeo
Dated: Wednesday March 2 2005 - 14:43:57 GMT
If you mouseover "select text size" in the navigation bar, the menu appears.
Current Version:
Eye Vitamins
Test Version:
Eye Vitamins with new menu
The idea is to change the style without refreshing the page. It works in FireFox and Opera, but not in IE6. (It doesn't work at all in NN7, but I have no idea why.)
Re: JavaScript function - return false;
Poster: kevin3442
Dated: Friday March 4 2005 - 0:29:06 GMT
arkeo wrote:
...When calling a JavaScript function with clickfunction=, onfunction=, offfunction=, etc., how do you specify "return false"?..."
I can only offer some guesses without checking the version 5 code you're using to test (I saw the version 3 menu on your Current Version page, but didn't see a menu on your Test Version page).
Have you tried returning false from your setActiveStyleSheet() function? (i.e., add return false; to the end of the function).
You could also try using the url property instead of the clickfunction property. E.g:
Code:
aI("text=Large;url=javascript:setActiveStyleSheet('large');return false;");
I've done that sort of thing before with success. The system should differentiate the additional js code (;return false) and not treat it as another menu property. If there's a problem, you might try adding single backquotes around the pertinent code, like so:
Code:
aI("text=Large;url=`javascript:setActiveStyleSheet('large');return false`;");
You might also try backquotes with clickfunction, like:
Code:
aI("text=Large;clickfunction=`setActiveStyleSheet('large');return false`;");
Some things to try anyway.
Kevin
Poster: arkeo
Dated: Friday March 4 2005 - 16:27:57 GMT
Thanks for your response and sorry about the version 5 code not being available.
Unfortunately, none of those solutions worked and I am already specifying "return false" in the function itself. It seems like IE is choosing to ignore it, though.
I'll have the new version online pretty soon and we'll be working on the next phase of the project, so I'll ask the question again when the code is available.
Thanks again,