/ref_m-q.htm#protocol_property">protocol, search properties
hostname property
a string specifying the host and domain name, or ip address, of a network host.
语法
1. links[index].hostname 2. location.hostname
index is an integer representing a link object.
property of
描述
the hostname property specifies a portion of the url. the hostname property is a substring of the host property. the host property is the concatenation of the hostname and port properties, separated by a colon. when the port property is null, the host property is the same as the hostname property.
you can set the hostname property at any time, although it is safer to set the href property to change a location. if the hostname that you specify cannot be found in the current location, you will get an error.
see section 3.1 of rfc 1738 for complete information about the hostname.
例子
see the 例子 for the href property.
相关
href property
a string specifying the entire url.
语法
1. links[index].href 2. location.href
index is an integer representing a link object.
property of
描述
the href property specifies the entire url. other location object properties are substrings of the href property. you can set the href property at any time.
omitting a property name from the location object is equivalent to specifying location.href. for example, the following two statements are equivalent and set the url of the current window to the netscape home page:
see rfc 1738 for complete information about the url.
例子
in the following example, the window.open statement creates a window called newwindow and loads the specified url into it. the document.write statements display all the properties of newwindow.location in a wind