location Properties DHTML Objects
Sets or retrieves the hostName and port number of the location or URL.
HTML |
N/A |
Script |
object.host [ = sHost ] |
sHost |
String specifying the hostName and port number. |
The property is read/write with no default value.
The property is the concatenation of the hostName and port properties, separated by a colon ( hostName:port ). When the port property is null, the host property is the same as the hostName property.
The host property may be set at any time, although it is safer to set the href property to change a location. If the specified host cannot be found, an error is returned.
The following example displays the location host property in a message box.
alert ( location.host )
Show me
A, AREA, location