JavaScript function - return false;

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
arkeo
Beginner
Beginner
Posts: 7
Joined: Tue Mar 01, 2005 4:27 pm
Location: Fort Worth, Texas
Contact:

JavaScript function - return false;

Post by arkeo »

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
Jonathan Jeter
Web Developer
Arkéo, Inc.
Fort Worth, Texas
http://www.arkeo.com
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
arkeo
Beginner
Beginner
Posts: 7
Joined: Tue Mar 01, 2005 4:27 pm
Location: Fort Worth, Texas
Contact:

Post by arkeo »

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.)
Jonathan Jeter
Web Developer
Arkéo, Inc.
Fort Worth, Texas
http://www.arkeo.com
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: JavaScript function - return false;

Post by kevin3442 »

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: Select all

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: Select all

aI("text=Large;url=`javascript:setActiveStyleSheet('large');return false`;");
You might also try backquotes with clickfunction, like:

Code: Select all

aI("text=Large;clickfunction=`setActiveStyleSheet('large');return false`;");
Some things to try anyway.

Kevin
arkeo
Beginner
Beginner
Posts: 7
Joined: Tue Mar 01, 2005 4:27 pm
Location: Fort Worth, Texas
Contact:

Post by arkeo »

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,
Jonathan Jeter
Web Developer
Arkéo, Inc.
Fort Worth, Texas
http://www.arkeo.com
Post Reply