Area.hostname

JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+, Opera3+ Syntax

document.links[num].hostname

Description

The hostname property associated with the Area object contains just the hostname that is specified in the URL. This property is a read/write string.

Example

In Listing 7.11, a sports car picture site is created. Selecting your location determines from which site a large picture of the sports car is retrieved. This is accomplished by modifying the hostname property based on the site from which the user wants to receive the sport car pictures. Notice that, unlike the host property, the port number stays the same when modifying the hostname property.

Listing 7.11 Modifying the hostname Property of the Area Object
 <html> <body> ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.