View Full Version : Setting a link to open a new window

01-24-2003, 05:31 AM
can some one please tell me what the code looks like to make a web page link open a new window to another web page.

01-24-2003, 06:08 AM
<a href="link/to/window" target="_top">link text</a>

01-24-2003, 06:51 AM
the font of the text doesn't show up. what am i doing wrong?

sample of my code: <a href="http://www.hostboard.com/cgi-bin/ultimatebb.cgi?ubb=forum&f=4190"target="><font face="Helvetica" size="-1"><span style="font-size:12">Message Baords</span></font></a>

01-24-2003, 08:01 AM
Try inserting some spaces to separate the different attributes, your target isn't set, and why do you use both the (deprecated) font element and an inline style? Try:

<a href="http://www.hostboard.com/cgi-bin/ultimatebb.cgi?ubb=forum&f=4190"
<span style="font-family: helvetica, sans-serif; font-size: 12px">
Message Boards
Update: i followed along like a tame sheep, but the target should have been _blank; _top refers to the top-level window. By the way: any name that doesn't exist yet results in a new window, so provided that no window with the name "foobar" exists,
<a href="foo.html" target="foobar">A new window</a>opens a new window by the name of "foobar" (if it does exist, it opens the referred page in that window).
Oh, and I did some checking: the HTML 4.01 Recommendation doesn't say a word about the four general names, only about the use of target to address frames, and W3Schools indicates that the target attribute is not in the strict DTD.
What else do we use to open a new window then?!!

01-24-2003, 01:42 PM
mr. ...
/me would just a use® the ...target=_new ... to get just a new® window...n' leave yourrr 'clicked from here page' still in the background...

ifin' they just a used® yours??? twouldnt that just a replace® their 'current' clicked from here page??? aka it twouldnt open just a new® browser???

"quote...What else do we use to open a new window then?!!...endquote"
/me just a uses® the ...target=_new

01-24-2003, 02:47 PM
The loss of target is a mistake, I think.

The only workarounds I can think of: Use an onclick event to open a new window (which fails badly if javascript is not enabled), or add a message telling users to hold down the shift key if using IE or the control key if using Mozilla/Netscape while activating the link (which opens the file in a new window).

I dislike both.

01-24-2003, 06:05 PM
thx for all the help guys. i'm soooo glad i found this place.

01-24-2003, 07:26 PM
Hey, I was up late and had a drastic dip in my caffeine level, so what if I was thinking blank and typed top...so shoot me people! :thumbsup:

01-25-2003, 03:05 AM
Originally posted by Feyd
1...Hey, I was up late
2...had a drastic dip in my caffeine level,
3...so what if I was thinking blank and typed top...
4...so shoot me people! :thumbsup:

1...just a excuses/excuses/excuses® hehehe...
2...just a rotflmao®!!!!!! wheeere is 'dom' whennn /me neeeds himmm...more lol'in...geeezzz.../me just a bout® spewed her [_]? readin' thattt from you!!! youuu??? caffine??? n' youuu used to 'request' /me n' dom nottt drink it??? lol...
3...thattts ok.../me totallly understands...since you dooo just a remember® /me isnt programmed to think either...:O)))
4...nahhh /me will just a hugs® ya instead...:O)))

01-27-2003, 09:08 AM

the four general target values are _blank, _parent, _self and _top; _new isn't and will only open a new window named "_new" provided that it doesn't exist yet, falling under the "any name" cases.

01-27-2003, 02:44 PM
/me just a uses® ..._new ...alll the time...aka...
<a href="whatever.html" target="_new">just a click® here n' whatever.html opens</a>

01-27-2003, 03:41 PM
A sidenote: I was looking through the XHTML 2.0 specs the other day and noticed that target has been brought back. Let's hope that when they make 2.0 official, that remains true.