Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

anchor tag target attribute value

Status
Not open for further replies.

mj09

Programmer
Oct 2, 2001
2
US
what is the difference between the "_top" and "_parent" value for the target attribute of the Anchor tag? They seem to be doing the same of opening the link in the whole window. Using Javascript "parent." you can target the individual frames but how is this done using _parent in html

e.g <a href=&quot; target=&quot;_parent&quot;>link</a>

When I read the explanation for &quot;_parent&quot;, the books say that when used with frames it opens up the document in the parent window or parent frame of the current frame.... but no matter which child-frame i use this attribute the page opens in the whole window...

Would appreciate some help with examples.

Thank you
 
Well, if you had a nested frameset, then it would matter.

If you ask for _parent in a frame that is a member of a single frameset, then the _parent will always be the entire page, but take this as an example:

mainFrame
|
|---------
| |
| childFrameSet
| |
| -------------------------
| | |
| navPage someOtherPage
|
--------Main page

In this setup, if you opened something with _parent on &quot;Main Page&quot;, then the link would open up in &quot;Main Page&quot;.

However, if you asked for _parent in &quot;someOtherPage&quot;, then the link would open up in &quot;ChildFrameSet&quot;

Whereas the _top would always open it in &quot;Main Page&quot;.

:)
Paul Prewett
penny.gif
penny.gif
 
err... up there where I was saying the links would open up in &quot;Main Page&quot;, I meant &quot;mainFrame&quot;

sorry for the confusion.

:)
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top