Targeting Links to Specific Windows


Targets let you open a link in a particular window, or even in a new window created especially for that link. This way, the page that contains the link stays open, enabling the user to go back and forth between the page of links and the information from each of those links.

Figure 6.11. In this example, some links will appear in the characters window and others will appear in the books window.


To target links:

Within the link definition, type target="window", where window is the name of the window where the corresponding page should be displayed.

Figure 6.12. When the visitor clicks a link with a target...


Tips

  • Target names are case sensitive! In addition, you should always enclose them in quotation marks.

  • Open a link in a completely new window by using target="_blank".

  • If you target several links to the same window (e.g., using the same name), the links will all open in that same window.

  • If a named window is not already open, the browser opens a new window and uses it for all future links to that window.

    Figure 6.13. ...the corresponding page is shown in the targeted window. In this example, it's the characters window.

  • Targets are most effective for opening Web pages (or even FTP links) in particular windows. They don't make sense for email or news links which open in different kinds of windows.

  • The W3C has removed the target attribute from (X)HTML strict to promote accessibility. Instead, they suggest using JavaScript or the yet-to-be-finalized XLink. I say, use target. (It is part of both (X)HTML transitional and frameset.)





HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net