Open new browser window

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lplatz
Forum Newbie
Posts: 4
Joined: Sun Jan 11, 2004 10:45 am

Open new browser window

Post by lplatz »

The following snippet is from a drop-down menu. Simple enough, however, if I use an external link to another site, I'd like to open the link in a new browser window. In the example below, I'd like to open the second item "Calculators" (http://www.calculators.htm) in a new browser window.

<item caption="Financial Planning">
<item caption="Managing Finances" link="mng_finances.php"/>
<item caption="Calculators" link="http://www.calculators.htm"/>
</item>

Thanks in advance!
Les
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

I guess you will have to use JavaScript to check if the link contains either http:// or www. or both and then go from there.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

I've never heard of an <item> tag, so I'm guessing that's proprietary or XML. What I do know is that generally the easiest, best way to open a link in a new window is like this:

<a href="whatever" target="_blank">klick!</a>
lplatz
Forum Newbie
Posts: 4
Joined: Sun Jan 11, 2004 10:45 am

Post by lplatz »

UNIPUS IS CORRECT! I found this out on my own only to return to see Unipus reply. Thank you for providing solution...works perfect.
Post Reply