PDA

View Full Version : AnyLink Vertical Menu (Open in New Window)



Jam3rai
10-13-2005, 10:40 PM
Script: AnyLink Vertical Menu
http://www.dynamicdrive.com/dynamicindex1/anylinkvertical.htm

Hello all you helpful people,

Here's my issue, and I hope you can help me. :)
All I wanna do is use this script, and when clicking on the links, open them in a pop-up window. Sounds simple enough I know... The script works but I can't get it open in another window for some reason. Here is what I tried so far:


//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="OpenNewWindow" target="_blank" onClick="javascript:window.open('http://www.runescape.com'); return false">RuneScape</a>'
menu1[1]='<a href="http://www.zybez.com">Zybez</a>'
menu1[2]='<A HREF="http://tip.it/runescape">Tip.It</A>'

Now... <a href="OpenNewWindow" target="_blank" onClick="javascript:window.open('http://www.runescape.com'); return false">RuneScape</a>.... does work, when it is in the <body>, but when placed here, it does not.

Secondly I have tried:



<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, LastAlliance, 'width=400,height=200,scrollbars=yes');
return false;
}
//-->
</SCRIPT>

//Contents for menu 1
var menu1=new Array()
menu1[0]='<A HREF="www.runescape.com" onClick="return popup(this, 'notes')">RuneScape</A>'
menu1[1]='<a href="http://www.zybez.com">Zybez</a>'
menu1[2]='<A HREF="http://tip.it/runescape">Tip.It</A>'

<A HREF="www.runescape.com" onClick="return popup(this, 'notes')">RuneScape</A> Also works in the <body> but not in this script.

Does anyone have any suggestions? I am open to anything. It would be most appreciated.

Thanks very much in advace.

Jam3rai
10-14-2005, 02:04 AM
Anyone? Please? I'm still working on this. Java can be such a pain! :mad: lol

ddadmin
10-14-2005, 10:39 PM
Hi;
Try this:


menu1[0]='<A HREF="www.runescape.com" onClick="return popup(this, \'notes\')">RuneScape</A>'

Note the backslashes to the left of the apostrophes (').

Jam3rai
10-16-2005, 07:04 PM
ddadmin,

Thanks very much for your help. Again it is very much appreciated. Unfortunatly I'm still having difficulties. I tried the code you supplied, but no luck. If it is any more help, here is the url of the page I'm trying to do this on: http://home.comcast.net/~lastalliance/toolbar.html and the full url of the page I'm working on is this: http://lastalliance.home.comcast.net.

I know... people should be anti-frames, lol. If anyone at all has any suggestions, it would just make my day to figure this out.

Even if someone has an entirely different way of doing this, I would be very happy.
Thanks again!

Jam3rai
10-17-2005, 06:28 PM
Omg... Ok, I figured it out. I KNEW it was going to be something really stupid and easy!!! Every type of java script would not make the links open in a new window... all I did was add target="_blank" after the URL.

Example:
<a href="http://www.google.com" target="_blank">Google</a>

I just wanted to post back to thank you for trying to help me, and to post what made it work. Just in case anyone else ever comes across this issue, they will know what to do now. I hope this helps someone!

PS: Don't laugh at me cause it was so simple! lol :)