Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q18 Where does the target="" go when using location.href=""?

irt.org | Knowledge Base | JavaScript | Link | Q18 [ previous next ]

Q18 Where does the target="" go when using location.href=""?

By default when using location.href="fileName.html", the target is the current document.

When coding location.href="fileName.html" what we are actually coding is document.location.href="fileName.html" or self.location.href="fileName.html", the self specifies the current window, or window.location.href="fileName.html".

When we need to target another window we need to navigate the window object hierarchy, either by specifying the parent frame, or the top frame (which may in fact be the same thing).

top.location.href="fileName.html" targets the top document.

top.frameName.location.href="fileName.html" targets the frame frameName within the top document.

parent.location.href="fileName.html" targets the parent of the current document.

parent.frameName.location.href="fileName.html" targets the child frame frameName of the parent of the current document, i.e. a sibling frame.

Feedback on 'Q18 Where does the target="" go when using location.href=""?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.