JavaScript EditorBest javascript editor debugger     Ajax website 

Main Page

Previous Page
Next Page

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...


  • 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.)

Previous Page
Next Page

JavaScript EditorBest javascript editor debugger     Ajax website