HTML and CSS Reference
In-Depth Information
Now return to the red page and click the second link. The blue page opens in a third
browser window. Note that the new windows probably won't be laid out like the ones
shown in Figure 17.2; they usually overlap each other. The following
target=“blue_page”
statement in the
parent.html
page is what causes the new window
to open:
<a href=“blue.html” target=“blue_page”>
Open
</a>
the Blue Page in a new
window.
</p>
The previous two examples opened each of the web pages in a new browser window. The
third link, however, uses the
target=“yellow_page”
statement to open the green page in
the window named
yellow_page
. You accomplish this using the following code in
par-
ent.html
:
<p><a href=“green.html” target=“yellow_page”>
Replace
</a>
the yellow page
with the Green Page.
</p>
Because you already opened the
yellow_page
window when you clicked the link for the
yellow page, the green page should replace the page that's already in it. To verify this,
click the third hyperlink on the red page. This replaces the contents of the yellow page
(with the
yellow_page
target name) with the green page (
green.html
), as shown in
Figure 17.6.
FIGURE 17.6
green.html
displayed in the
web browser
window named
green_page
.
▲
The
<base>
Tag
When you're using the
target
attribute with links, you'll sometimes find that all or most
of the hyperlinks on a web page should point to the same window. This is especially true
when you're using frames, as you'll discover in the following section.