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:33
Using DHTML Menu with onUnload javascript command
Poster: zscribe
Dated: Thursday April 10 2003 - 20:18:19 BST
Hello folks...
I am currently using the DHTML menu on my website and am very pleased with how it works. I've just added a pop-up on exit using javascript's onUnload command.
One of the things that I have to do with this script is to add an onClick="exit=false" command to each <a href> tag that I want to ignore the popup command.
My problem is that my pop-up script treats the DHTML menus and submenus as if they were <a href> tags and opens my pop-up every time a menu is selected. I don't want this to happen.
Is the onClick="exit=false" command the right code for me to use in the menu_array.js file so that my pop-up will ignore the clicks on the menu?
And if so, where in my menu_array file should I place the onClick="exit=false" command?
Hope someone can help me.
Thanks!
Candy Zulkosky
Poster: kevin3442
Dated: Saturday April 26 2003 - 8:27:16 BST
Hi Candy,
I suppose you could surrond the menu item's Description Text (the menu item text) with an <a> tag and but the onClick event in the opening tag, as usual. Like this:
Code:
,"<a onClick='exit=false'>Item Text</a>","theurl.htm",,,1
Don't know if that'd work though.
I think a bigger issue is... What script are you using for the popups? Sounds to me like a huge hassle to have to add something to every <a> tag and every menu item just to prevent something from happening. It's an odd approach to require an event handler to suppress a response; it also generates more code overhead. The more typical approach is to add code only to the tags where you want an event to trigger a response. If this is a script you downloaded, I'd humbly suggest maybe looking for a different script. Are these popups simple text boxes, or are they new windows? If text boxes, you could even co-op the menu code with a few extra functions to have it pop up a text box for you. (If they're popup windows, then they are evil!!! )
Hope that helps,
Kevin