PDA

View Full Version : Anylink Drop Down not working in subdirectories



Mng026
08-05-2008, 03:11 PM
1) Script Title: Anylink Drop down menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem: Drop down does not appear when I link to it in subfolders. I realize I have to update the links, but couldn't seem to locate the missing code. I realize this is probably a pretty stupid question, but it's in fact driving me nuts, and any help is appreciated. A link to a page that is not functioning is http://www.mikegrantonline.com/login/clients.html --- The top three tabs should be dropping down as seen on the homepage. Thanks in advance.

Mike

jscheuer1
08-05-2008, 04:12 PM
Your page is in violation of Dynamic Drive's usage terms (http://www.dynamicdrive.com/notice.htm), which, among other things, state that the script credit must appear in the source code of the page(s) using the script. Please reinstate the notice first.

You may take care of the above violation by changing the external tag from (and similar) on all pages using this menu:


<script src="../js/dropdown.js" type="text/javascript"></script>

to:


<script src="../js/dropdown.js" type="text/javascript">

/***********************************************
* AnyLink Drop Down Menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

Also, this:


<!--

and this:


//-->

don't belong in the external script file.

On to your problem - Where you have:


dropdownmenu(this, event,'../menu1', '135px')

and similar, it should be:


dropdownmenu(this, event,menu1, '135px')

Since you are accessing the same menu from the same script, no path is required. In fact, that part of the call is not a path at all but a reference to an array. In the case of the example above, it is this array (from the script):


//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="about.html">About Mike Grant</a>'
menu1[1]='<a href="resume.html">View Resume</a>'


That's where the path will matter. Since you are using it from a different folder and it is referencing pages in the root, the network path will do for any page in any folder (including the root) on the site:


//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="/about.html">About Mike Grant</a>'
menu1[1]='<a href="/resume.html">View Resume</a>'

One other thing about this script that has nothing to do with your problem is that it has always had a minor error here:


dropmenuobj.style.left=dropmenuobj.style.top=-500

That line should be:


dropmenuobj.style.left=dropmenuobj.style.top='-500px';

This might never cause an issue with your particular installation, but it might. So may as well take care of it now.

Mng026
08-05-2008, 04:29 PM
Hi John,
Thanks for your quick reply. In response --

1. Sorry about the notice, I didn't realize it should even appear on external linked files. I'll put it in there.

On to the problem --
2. When dreamweaver 'updated my links' I saw it updated the '../menu1' etc. arrays, I thought this was odd, and changed it, but it did not work, so I changed it back to the way it was. Anyhow, I modified it like you suggested, and am still not seeing my drop down, any other thoughts?? Thanks in advance..

Mike

jscheuer1
08-05-2008, 04:53 PM
Anyhow, I modified it like you suggested

I don't think so, remove the quote marks so that it looks like what I put in my post. Do it like this:


dropdownmenu(this, event,menu1, '135px')

Not like you currently have it:


dropdownmenu(this, event,'menu1', '135px')

Thanks for fixing the credit.

Mng026
08-05-2008, 04:56 PM
oops! Dreamweaver must of added the '' when it changed the array to a link -- that did the trick indeed! Thanks a bunch.

Mike