PDA

View Full Version : Add ability to use target="_blank" to HV Menu



shobuz99
06-18-2011, 12:43 AM
1) Script Title: HV Menu

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

3) Describe problem:
I would like to add the ability to use the target="_blank", ="_parent", ="_top", ="_self" when selecting a menu item that goes to an 'external' web link.

Presently, the settings in the "exmplmenu_var.js" file for each menu item are:
// Menu tree
// MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);
// For rollover images set "Text to show" to: "rollover:Image1.jpg:Image2.jpg"

Typical Menu item:
Menu2=new Array("xyz.com News Highlights","http://www.xyz.com/","",0,20,200);

There is no ability to open a new browser window or tab for the external link, that is called in the above item.
In HTML, the code for a new window or tab would be:
<a href="http://www.xyz.com/" target="_blank">"xyz.com News Highlights</a>
How can I add that ability, and where must it be added? In the both the "exmplmenu_var.js" and the "menu_com.js" files?
I've been using the HV Menu 5.5 system for 5 years. I really like it better than the CSS menus I've tried.

I'm not a Java Script programmer, and have no idea where to begin.
Thank you for any advice or ideas you can offer.
I appreciate it very much.
(Rick) Shobuz99

jscheuer1
06-18-2011, 01:36 AM
That's an old menu and what we call 'third party' (was user submitted) to boot. So we technically don't support it.

That said, I would try:


Menu2=new Array("xyz.com News Highlights","javascript:window.open('http://www.xyz.com/','_blank')","",0,20,200);

or:


Menu2=new Array("xyz.com News Highlights","javascript:void(window.open('http://www.xyz.com/','_blank'))","",0,20,200);

If memory serves this has come up before albeit quite some time ago and one or the other perhaps even either of those did the trick.

shobuz99
06-18-2011, 01:59 PM
That's an old menu and what we call 'third party' (was user submitted) to boot. So we technically don't support it.

That said, I would try:


Menu2=new Array("xyz.com News Highlights","javascript:window.open('http://www.xyz.com/','_blank')","",0,20,200);

or:


Menu2=new Array("xyz.com News Highlights","javascript:void(window.open('http://www.xyz.com/','_blank'))","",0,20,200);

If memory serves this has come up before albeit quite some time ago and one or the other perhaps even either of those did the trick.

Thank you very much, John. I know it's quite an old menu.
I noticed that the last time I logged on here was in 2006! I guess that makes the menu at least 5 years old.
Do you recommend a new menu from here that would make a good replacement and update for the HV Menu I'm using?
Just wondered.

BTW... the only problem I ever encountered with the HV Menu, occurred when the IE7 and IE8 browsers came out.
I had to instruct users of the websites I designed with HV Menu, to use the
"compatibility view" so that the HV Menu would operate correctly.
Prior to using "compatibility view", the HV Menu sub-menus, with IE7/IE8,
would appear at the top of the page, instead of adjacent to the main menu item.
I was criticized by some programmers for using HV Menu for that reason.
Do you know of any way that HV Menu could be changed to work better with IE7/IE8, in that regard?
I value your opinion.
Thank you again for your help.
(Rick) shobuz99