AITech Solutions Home Services Contact Us About Us Website & Servers |
Tutorial Topics: A, |
The target attribute is used with the anchor tag to specify where the next page will open when a hyperlink is clicked. Without the target attribute, clicking the hyperlink will cause the "target" of the link to open in the same window. Using the target attribute will allow the target to be displayed in a new window or a particular frame. The value of the target can be the name of a frame or one of the predetermined values. These predetermined attribute values are:
Note that the above all begin with a underscore and are lower case. In the following sections we will go over each of the target attributes.
The target="_blank" attribute causes the "target" of the hyperlink to open in a new, usually smaller, window.
The target="_top" attribute causes the "target" of the hyperlink to display at the top level of all currently defined framesets. For instance, Say you have 2 framesets defining a page. One called header.html defining the page header and a second named content.html that defines the rest of the page. If you create a hyperlink in the content area that uses target="_top", once clicked, it makes it self the top level frame replacing the header.html and content.html frameset structures. In short..fills the entire page! If you are using CSS instead of frames, most browsers will also display this as a full page, replacing the current content.
The target="_parent" attribute causes the "target" of the hyperlink to display in the entire area of the current frameset. For instance using the above conventions and structures, say the content.html frame contains a frameset of 3 files such as; leftpane.html, maincontent.html, and rightpane.html. If you create a hyperlink in the maincontent.html frame area that uses the target="_parent", once clicked, instead of displaying just in the current maincontent.html frame area, it displays in the entire content.html frameset area. That is, it takes up the area of leftpane.html, maincontent.html, and rightpane.html. If you are not familiar with frames then this is probably as clear as mud. See the related links section for a link to W3C's comprehensive article on frames. If you are using CSS instead of frames, most browsers will just display this as a full page, replacing the current content.
The target="_self" attribute causes the "target" of the hyperlink to open in the current frame. This is the behavior that is used if the target attribute was not used at all. If you are using CSS instead of frames, most browsers will just display this as a full page, replacing the current content.
The value of the target attribute can also be the name of a frame or window. For example, using the above example where we have a leftpane, maincontent, and rightpane.html frames and the maincontent.html is defined with a name of mainwindow. Say we put a link in the leftpane frame and use target="mainwindow", then once clicked, instead of displaying in the current leftpane.html frame area it displays in the maincontent.html frame area.
Version 1.0 Copyright © 2007 www.AITechSolutions.net. All rights reserved. Terms of Use
Using target="_blank"
Using target="_top"
Using target="_parent"
Using target="_self"
Using target=[Frame Name]