PDA

View Full Version : Anylink Menu works on one, not the other



Woody56
03-03-2010, 10:18 PM
1) Script Title: Anylink JS Drop Down Menu v2.0

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

3) Describe problem: I've been using this code on my site with no problems...it works as advertised. See at: www.todaystruth.com/Mags.htm
My problem is that I'm now redesigning the page to match the Home page, and I can't get the thing to work on the new page. I copied and pasted all the pertinent code so I wouldn't leave anything out, both in the Head section and the Body, but when I preview in the browser it won't work. Am I breaking some js rule of which I am unaware? Thanks in advance.

icywindow
03-04-2010, 12:32 AM
Could you give a link to the page that you're designing?

If I had to guess, you might need to duplicate the naming scheme if you want two instances of the same menu on the same page. Is that what you're trying to do? Or is it simply trying to migrate things over to the new/redesigned page?

Woody56
03-04-2010, 03:41 AM
The page I'm designing is not yet online...just on my PC. And yes, I'm "simply trying to migrate things over to the new/redesigned page" so I don't understand why it works on the original and not on the new. I'm working within Dreamweaver MX, and the original page (on my PC) works when I preview it, but the new does NOT. The scripts are identical.

icywindow
03-04-2010, 02:41 PM
Okay, I'd check the following two things, since I don't have your page that you're designing in front of me. :)

1. Are the .js files included in the <head> section of your page?
2. Check the names assigned to the divs, and make sure they're not duplicated.

Woody56
03-04-2010, 06:26 PM
OK icywindow, I've checked both things, and yes the .js files are called from the <head> section as they are on the original page. Also, I couldn't find any duplicate divs in the page. Is there any easy way I can let you see the new page I'm designing, or is that too large to post here? Just the code, since I obviously can't include the .js files or the stylesheets.

icywindow
03-04-2010, 06:58 PM
http://pastebin.com/
http://pastie.org/

Either of these works well for pasting the code. Get a link and paste the link to the code for the page.

Woody56
03-04-2010, 07:39 PM
OK, icy...here's the link: http://pastebin.com/3kvRgt8a
And I posted under my UserName of Woody56. The pertinent lines are 10, 12, 14, 26, 72, 87, 90, 105, 108. Hope you can find something I'm missing to make this an easy fix!

icywindow
03-05-2010, 07:37 PM
Where is your MMLoadMenus() declaration in the header of that page? I think either you have to remove that call in the body or add the code to the <head> section of the page so that the javascript compiler doesn't error out like I believe that it is currently, and thus not showing your menus.

Hope that helps. :)

Woody56
03-05-2010, 08:50 PM
No declaration in the <head> section was called for in the instructions for the script, so I was unaware of the need...and if you look at the source for the page http://www.todaystruth.com/Mags.htm it doesn't have it either. I copied and pasted the code from DD. But it works for my page online, and on my PC for that same page, but not for my new page. Do I need to scrap the whole thing and use a NEW script for the DropDown Menu?

icywindow
03-06-2010, 08:03 PM
I don't think you need the call. I believe removing line 26 that says:



<script language="JavaScript1.2">mmLoadMenus();</script>


will solve your problem. If it doesn't, post back here, and I'll try to help again.

Woody56
03-07-2010, 07:34 PM
Icy...thanks for your attention to my dilemma. Unfortunately the suggestion made no difference. The menu still does not work. And I removed the line in question from my current page, and the menu STILL works on preview, so it would seem it is NOT needed. I have no idea where that line came from, but it is on the current page on the website, and THAT page works correctly.
Question: Is that line calling a function called mmLoadMenus();? And if that is the case, would not that function have to reside either in the <head> section or in my anylinkmenu.js file? I have looked in the file and see nothing which looks like said function, but I have pasted my file HERE: http://pastebin.com/RsPdtjEX for you to have a look at if you would. Do you see the function? If not, then the call on line 26 is a mystery!

icywindow
03-11-2010, 04:57 PM
I don't think that the mmLoadMenus() is part of the original script, but it worked in the one page, but hasn't in the other. In any case, if you wanted to put the script in the header of that page and try it, that might help. When I looked at your document in WinMerge (a great diff'ing utility), the main difference that I saw was that particular script line.

ATM, though, I'm not sure, I'll have to give it another look over.

Woody56
03-16-2010, 02:08 AM
Icywindow, I solved my problem...but I don't know how/why I did it. I duplicated the .js files and renamed them. Now the new page works fine. Is it not possible to link to a .js file from two separate pages? (This is probably javascript 101, huh?)
Anyway...thanks for all your input and attempts to solve my dilemma.
Woody56