How do I get a link loaded in the window, not frame?

T

Tim Streater

I have, as it might be, this in a frame:

<a href="mystuff.html">Click here</a>

When I click the link, it loads mystuff.html into the frame, whereas
what I want is to replace the whole window contents. How can I do this
while still using a link? What I want in effect is for clicking to do:

top.location.href = "mystuff.html"

instead of:

window.location.href = "mystuff.html"

Thanks,

-- tim
 
B

BootNic

Tim Streater said:
I have, as it might be, this in a frame:

<a href="mystuff.html">Click here</a>

When I click the link, it loads mystuff.html into the frame, whereas
what I want is to replace the whole window contents. How can I do this
while still using a link? What I want in effect is for clicking to do:

top.location.href = "mystuff.html"

instead of:

window.location.href = "mystuff.html"

Thanks,

<a href="mystuff.html" target="_parent">Click here</a>
 
E

Evertjan.

BootNic wrote on 23 jun 2005 in comp.lang.javascript:
<a href="mystuff.html" target="_parent">Click here</a>

<a href="mystuff.html" target="_top">Click here</a>


<http://www.w3.org/TR/NOTE-layout>:

target: _blank
Loads the linked document into a new blank window. This generally
provides the same navigation controls as other browser windows. Some
users will want to be able to disable this behaviour via a browser
preference setting.

target: _popup
Loads the linked document into a pop-up window. This is similar to
"_blank" except that pop-up windows are generally borderless and
automatically sized to match the document content, disappearing when
clicked.

target: _self
Loads the linked document into the same frame as the anchor that was
clicked on. This is useful for overriding an inherited target value.

target: _parent
Loads the linked document into the immediate parent frame of the frame
containing the clicked anchor. This defaults to acting like "_self" when
the clicked anchor isn't contained by a frame (i.e. its directly part of
the page).

target: _top
Loads the linked document into the full extent of the window. This acts
like "_self" when the clicked anchor isn't contained by a frame (i.e. its
directly part of the page).
 
T

Tim Streater

Evertjan. said:
BootNic wrote on 23 jun 2005 in comp.lang.javascript:


<a href="mystuff.html" target="_top">Click here</a>

[snip]

Thanks guys, that's the reference I needed.

-- tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top