View Full Version : Open Certain Links in a New Window - AnyLink Menu

04-05-2011, 06:19 PM
1) Script Title: AnyLink JS Drop Down Menu v2.2

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

3) Describe problem: We have been searching the forums here and cannot find a way to make only CERTAIN items in the drop menu open in a new window.

We have already tried this:

var anylinkmenu1={divclass:'anylinkmenu', inlinestyle:'', linktarget:''}
["Item 1", "google.com", "", "_blank"],
["Item 1", "google.com", "", "_self"]

We have also tried this:

var anylinkmenu1={divclass:'anylinkmenu', inlinestyle:'', linktarget:''}
["Item 1", "google.com", "_blank"],
["Item 1", "google.com", "_self"]

These are based on posts in this forum. None of these options work for both IE and Firefox.

Can anyone tell us how to write this properly?

04-05-2011, 07:24 PM
There is another version of the anylink menu where the menu items are in the html and not in a separate menucontents.js file. You can find the script here:

if you don't specify the target it will open in the same window, but you can get it to open in a new window like this

<div class="column">
<b>Web Development</b>
<li><a href="http://www.dynamicdrive.com/" target="_blank">Dynamic Drive</a></li>
<li><a href="http://www.cssdrive.com">CSS Drive</a></li>
<li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li>
<li><a href="http://www.codingforums.com">Coding Forums</a></li>
<li><a href="http://www.javascriptkit.com/domref/">DOM Reference</a></li>

in this example only the red link opens in a new window. It works in both IE and firefox

04-05-2011, 07:33 PM
Thank you and we have seen that, however this code has been implemented on a 200+ page website and it is imperative that the menus are in an external file so unfortunately deploying a completely different menu is not an option.

Do you know how to code this version so it works?

04-05-2011, 08:07 PM
No I don't know, but I found this thread
and it seems like DD has made a modification of the script that should fix it. You could give it a try !

04-05-2011, 08:44 PM
Yeah that worked! I did see this post when doing research however I failed to see there was a new anylinkmenu.js file. That was why it did not work.

Thanks for helping, it is much appreciated.

For anyone who has this problem in the future -- be sure to download the new .js file as found at the end of the post in the link above.