javascript手冊-h[4]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 longj 的 blog

/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

link, location

描述

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.

相关

  • hash, host, href, pathname, port, protocol, search properties

    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

    link, location

    描述

    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:

    window.location.href="http://www.netscape.com/" window.location="http://www.netscape.com/"

    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

  • 本文关键:javascript
      相关方案
    Google
     

    本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

    go top