• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Working with Links, Lists, a... > The <A> Element: Hyperlinks and Anch...

The <A> Element: Hyperlinks and Anchors

You create hyperlinks with the <A> element, of course, as well as HTML anchors that can serve as hyperlink targets. Like the location object (see Chapter 10, “Using the navigator, location, and history Objects”), this element not only holds the target of the hyperlink in the href property, but also enables you to dissect that URL in a handy way, using several properties such as hostname (the www.name.com part), host (the same as the hostname property with a port number appended if there is one—for example, in the URL http://www.name.com:80/index.html, the hostname is www.name.com:80), href (the current URL in full), hash (the part of the URL following the hash mark (#) in the URL if there is one), and pathname (the filename or path specified in the URL). Here’s the URL we dissected when looking at the location object in Chapter 10 (it discusses the changes in the HTML 4.01 W3C specification):

http://www.w3.org/TR/html4/appendix/changes.html#19991224 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint