Getting links to open in new page on a DHTML heir-menu...

They have: 32 posts

Joined: Jun 2001

I downloaded this heir-menu from Dynamic Drve called HVMenu...and, while it's a great script, I can't figure out how to get some links to open in a new window! I've tried the standard JS snippet, but it conflicts with the script....anyone have any ideas?

dk01's picture

He has: 516 posts

Joined: Mar 2002

If you have php cabability then ou could make a page called newwin.php with the source:
=======================================================

<script language="Javascript">
url="

<?php
echo($url);
?>
";
popup = window.open(url,'myWin');
location.replace("
<?php
echo($HTTP_SERVER_VARS["HTTP_REFERER"]);
?>
");
</script>

=======================================================

and then when you want a link in your navbar to open in a new window just make the link to

Although this is sort of a round about method I beleive it would work and would save you from having to edit the script.
-dk

They have: 32 posts

Joined: Jun 2001

Unfortunately, I don't! The website is at work, and I don't have access to the DB...and I don't think anyone who did would even know how to install it....thanks for the response though! Anything else possible?

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

I downloaded the script and it can be done like this:

In the script you see the part where the menu items are built. You have probably altered it already. In the orginal script it looks like this:

Menu2_1_1=new Array("CNN","http://www.cnn.com","",0,20,150);
'

If you change that to:

Menu2_1_1=new Array("CNN","javascript: open('http://www.cnn.com')","",0,20,150);
'

then it makes CNN.com appear in a new window.

[edit] make sure you loose the space in 'java script' ;)[/edit]

Hope it helps,

Shakespeare: onclick || !(onclick)

They have: 32 posts

Joined: Jun 2001

Jack! You da man! That worked like a charm! I really appreciate your help! Thanks!

They have: 32 posts

Joined: Jun 2001

Quote: Originally posted by dk01
Ok well if you want I have uploaded what I wrote above to an address and if you want you can use it. All you have to do is write
">
and replace http://www.mydomain.com/mypage.html with the address you want to open in the new window. This way you do not need php. Otherwise you will have to find a way to edit the Menu script to include a window reference.
Hope that helps.
-dk [/B]

Hey man, thanks! I really appreciate you taking the time to try and help out a webmaster in need! Mucho Gracias!

dk01's picture

He has: 516 posts

Joined: Mar 2002

No problem. If I would have just downloaded the script it would have been easier but as I am on a php drive right now I guess I leaned that way. Good call Jack.
-dk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.