PDA

View Full Version : AnyLink Drop Down Menu js modification



drh
09-25-2005, 08:41 PM
AnyLink Drop Down Menu
http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
-------------

Thanks for the easy to configure drop down menu. Have a question somewhat related to this thread on making the top level link clickable when the page is viewed by browsers which don't fully support the script (in my case, NN 4.x and IE 5 Mac):
http://www.dynamicdrive.com/forums/showthread.php?t=4291&highlight=AnyLink+Drop+Menu

My problem was that after implementing the script on a site, I found that certain Mac browsers (as ref'd above) would not render the drop downs, which I knew would be the case. So, I created a link listings page for each of those links for which sub-menus were supposed to be created. Unfortunately, could not access those links listings pages by clicking on the top level link. Prior to my finding the solution identified in the thread above, I tried to debug the problem by modifying the clickreturnvalue function in the menu js as follows:

Changed:

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

to:

function clickreturnvalue(){
if (ie4||ns6) return true
else return true
}

Seems to work, as now all top level links are clickable and take the visitor to the link listings page for those particular top level links.

Would this be a better way to implement this (in terms of working cross browser/cross platform) or would it be better to take the onclick call out of the html? Right now I've tested this with all Mac browsers from NN4.x through current versions of Mozilla/Firefox, Opera, OmniWeb, Shiira, and Safari .... as well as the only Windows browser I have access to (IE 6) with no problems. My only concern is to ensure the script degrades as gracefully as possible.

jscheuer1
09-25-2005, 10:37 PM
That modification should be fine as long as your goal is to have all top level elements, when clicked, load the page that their href attribute is set to, in all browsers. Otherwise, a different way of discriminating among the various browsers is required. A note here, few of the stock DD scripts are written with a Mac in mind, or tested on one. One exception is the browser sniffer script whose contents may be instructive if you decide to be more discriminating among browsers/OS's.

drh
09-25-2005, 10:59 PM
After reading through all of the possibly related posts, I figured either way would work. In testing the js modification I made, it seemed it would work across the board. Just wanted a little reassurance. The site it will be used on is for our county's sheriff's office (up in nw PA .. Erie county). The sheriff is a friend of mine and I've been running his site for quite some time now. He continually wants additional content and things are to the point where I need to conserve screen space and the drop down menu will work well. Since it is a community service type site ... my goal is to exclude no one.

Thanks,

Dennis