Home > Articles > Web Development > Microsoft Expression Studio

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Creating Hyperlinks

Expression Web 3 provides tools to create hyperlinks quickly and easily. To create a hyperlink, select the text or graphic you'd like to use for the link and then select Insert, Hyperlink to display the Insert Hyperlink dialog shown in Figure 3.6.

Figure 3.6

Figure 3.6 The Insert Hyperlink dialog contains all the tools needed to create your hyperlinks.

Along the left edge of the Insert Hyperlink dialog are four buttons that define the type of hyperlink to create. By default, Existing File or Web Page is selected. You can also choose to create a link to a place in the current document (an HTML bookmark), a link to a new document, or an email address.

Targeting Hyperlinks

By default, hyperlinks to other pages or other sites will load into the current browser window. In many cases, that might be exactly what you want, especially when linking to files within your own site. However, if you are linking to another site or you have some other reason for wanting the current page to still be available after someone clicks your link, you need to override that default behavior.

To change the window in which a hyperlink opens, specify the target for the hyperlink. Click the Target Frame button in the Insert Hyperlink dialog to display the Target Frame dialog shown in Figure 3.7. Expression Web 3 provides a list of common target frames, but you can also specify your own frame name when you are targeting a specific frames page.

Figure 3.7

Figure 3.7 The Target Frame dialog lets you easily specify a target for a hyperlink.

Hyperlink Parameters

When you're using ASP.NET, PHP, or another server-side technology, you might need to pass information to the web server in a hyperlink in the form of a query string. A query string is appended to the end of a hyperlink as a series of names and values. Code that runs on the web server can access the values that are passed by referencing the name in the query string.

The following hyperlink passes a value called prod with a value of 6:

cool.aspx?prod=6

Note that a question mark appears before the query string value.

You can easily create a query string hyperlink in Expression Web 3 by clicking the Parameters button in the Insert Hyperlink dialog. Doing so will display the Hyperlink Parameters dialog. In Figure 3.8, you see the hyperlink parameter that created the hyperlink shown previously.

Figure 3.8

Figure 3.8 The Hyperlink Parameters dialog allows you to create query string parameters in a hyperlink. It's actually just as easy to enter them into the hyperlink text.

The Hyperlink Parameters dialog is convenient if you have a lot of parameters and want to work with them often, but I find it just as easy to type parameters manually.

HTML Bookmarks

Most hyperlinks take you to the top of the page to which it is linked, but you can also link to a specific point in a page using an HTML bookmark.

An HTML bookmark defines a point within a document. To create a link to an HTML bookmark, you first must create the bookmark in the page. Place the insertion point on the line where you want the bookmark, and then select Insert, Bookmark to display the Bookmark dialog shown in Figure 3.9.

Figure 3.9

Figure 3.9 HTML bookmarks are managed in the Bookmark dialog and allow you to link to a specific point within a page.

After a bookmark has been created, you can link to the bookmark using the Bookmark button in the Insert Hyperlink dialog to display the Select Place in Document dialog, as shown in Figure 3.10. Select the bookmark for your hyperlink to link to that point in the document.

Figure 3.10

Figure 3.10 Expression Web 3 lists all bookmarks on the page you're linking to so you can select the correct point for your hyperlink.

You can link to bookmarks on pages in external sites as well. When you click the Bookmark button, Expression Web 3 will parse the remote page for bookmarks and display them in the Bookmark dialog.

Hyperlink ScreenTips

To make your site accessible, include a title attribute for all your links. The title attribute is configured using the ScreenTip button in the Insert Hyperlink dialog. The text you enter for the ScreenTip will appear as a pop-up when a site visitor hovers over the link. It will also be read by screen readers.

  • + Share This
  • 🔖 Save To Your Account