PDA

View Full Version : anylinkmenu2 name confusion / set up question



trackermo
08-12-2009, 03:42 PM
1) Script Title: Anylink Drop Down Menu

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

3) Describe problem:

I have uploaded this and run a test page (see http://www.trackermo.com/testjs.html) but when I try to edit the menucontents.js and repeat any of the drop-down menus, I run into trouble. (FYI: I am trying to simplify the menus in left column of my index page, www.trackermo.com especially under Top Ranks. I would like each heading -- Safelists, Traffic Exchanges, etc. -- to have a drop-down menu.)

I am a bit confused anyway, because the name "anylinkmenu" is used so many different ways. Then it says, "Make sure "anylinkmenu1" is a unique name!"... as in:



var anylinkmenu1={divclass:'anylinkmenu', inlinestyle:'', linktarget:''} //First menu variable. Make sure "anylinkmenu1" is a unique name!
anylinkmenu1.items=[
["Dynamic Drive", "http://www.dynamicdrive.com/"],
["CSS Drive", "http://www.cssdrive.com/"],
["JavaScript Kit", "http://www.javascriptkit.com/"],
["Coding Forums", "http://www.codingforums.com/"],
["JavaScript Reference", "http://www.javascriptkit.com/jsref/"] //no comma following last entry!
]



var anylinkmenu2={divclass:'anylinkmenu', inlinestyle:'width:150px; background:#FDD271', linktarget:'_new'} //Second menu variable. Same precaution.
anylinkmenu2.items=[
["CNN", "http://www.cnn.com/"],
["MSNBC", "http://www.msnbc.com/"],
["Google", "http://www.google.com/"],
["BBC News", "http://news.bbc.co.uk"] //no comma following last entry!
]


When I change the "anylinkmenu2=" to "myownname=" it doesn't work. (And, yes, I changed it in both instances, i.e., "myownname={divclass..." and "myownname.items=[..."

Is there somewhere else it needs to change? That is, such as in the command within the actual page (below)?

Also, in the instructions, it says:


<!--2nd anchor link-->

<p><a href="http://www.dynamicdrive.com" class="menuanchorclass someotherclass" rel="anylinkmenu2[click]" rev="lr">Right dropping menu</a> (click to reveal)</p>

What does someotherclass refer to? Is that something that needs to be changes, as well?

Any help would be much appreciated.


Mo

ddadmin
08-13-2009, 05:59 AM
Firstly, you should remove the duplicate code near the bottom of your page:


<script type="text/javascript">

//anylinkmenu.init("menu_anchors_class") //call this function at the very *end* of the document!
anylinkmenu.init("menuanchorclass")
</script>

The init() function should never be called more than once on the same group of class name (in this case, "menuanchorclass").

As far as:


What does someotherclass refer to? Is that something that needs to be changes, as well?

You can remove that class if you want. It's there simply to illustrate that you can insert multiple CSS classes into an element.

trackermo
08-13-2009, 12:35 PM
Okay, thanks!

I took out that code and that seems to have done the trick.

I think that was left over from the earlier version.... at least, I know I didn't add it recently. But I had tried to use this script earlier in the year. I also seemed to have managed the naming convention... I think I suspected THAT when, in fact, it was the extra ini command.

Thanks again!

Mo