to home page

BWRS
SEARCH

HOMETUTORIALSLINKSFORUMGLOSSARYNEWS
 
Target

More Tricks with Links -
Targeted Links

(includes how to open a second window)

So far our links have simply jumped us from page to page. However using the target attribute can give you more control. It can at it's simplest open up a new browser window, but it is probably more important in the concept of frames and controlling how you link between frames
Tesco.com - Every CD on UK release
advertisement

(1) The target attribute set as target="_blank"
(or how to open a second window)

You've probably seen tons of links on the web to open a second window whilst keeping the parent window open. Here is a typical example

click to open a second window

The code for this is dead easy

<a href="otherpage.htm" target="_blank">
click to open a second window
</a>

Now you've seen all this before except for the target attribute

This tells the browser to open the hyperlink in a new or blank window (defined by "_blank". Make sure you don't omit the _ . Others use the value "_new" but this is being phased out).

Apart from this, the major use for target is withframes where it tells the browser what frame to load the link into. Check our frame section out but here are some you should knowback to top

(2) specified target

You can set the name of each frame in a window and target a link to open in it

consider this framed window with 3 frames called "left", "top" and "bottom"

LEFTTOP
BOTTOM


a link within any of the frames with a target="left" will open a page up to replace the left frameback to top


(3) target="_top"

Useful when you want to get out of frames. When you have a window full of frames any link with target="_top" will load into the whole window obliterating the frames

1

2

arrow to right

3

 


(4) target="_self"

This is the default (and therefore redundant value). Means the next page loads into the same (or self) frame.


(5) target="_parent"

You're unlikely to need this one (which is good as it's bloody confusing)

Imagine you have a framed window with 2 frames. You then open a new frame set in the "top" frame contain itself 3 frames

page1
.htm

page2
htm

right arrow

page1
.htm

page3
.htm
page4
.htm


If you add target="_parent" to a link in any of these 2 new frames then the new page will open up in the theirparent frame (e.g. "top" frame) obliterating them like so

page1
.htm

page3
.htm
page4
.htm
right arrow

page1
.htm

page5
htm

back to top

Back to More LInks Main
BACK TO MORE LINKS MAIN