javascript手冊-h
javascript手冊-h hash propertyA string beginning with a hash mark (#) that specifies an anchor name in the URL. 语法1. links[index].hash2. location.hash
index is an integer representing a link object. Property oflink, location 描述The hash property specifies a portion of the URL. You can set the hash property at any time, although it is safer to set the href property to change a location. If the hash that you specify cannot be found in the current location, you will get an error. See RFC 1738 for complete information about the hash. 例子See the 例子 for the anchor object and the href property. 相关host, hostname, href, pathname, port, protocol, search properties hidden objectA text object that is suppressed from form display on an htm form. A hidden object is used for passing name/value pairs when a form submits. 语法To define a hidden object: <INPUT TYPE="hidden" NAME="hiddenName" [VALUE="textValue"]>
NAME="hiddenName" specifies the name of the hidden object. You can access this value using the name property.
VALUE="textValue" specifies the initial value of the hidden object. To use a hidden object's properties: 1. hiddenName.propertyName2. formName.elements[index].propertyName
hiddenName is the value of the NAME attribute of a hidden object.
formName is either the value of the NAME attribute of a form object or an element in the forms array.
index is an integer representing a hidden object on a form.
propertyName is one of the properties listed below. Property ofform 描述A hidden object is a form element and must be defined within a <FORM> tag. A hidden object cannot be seen or modified by a user, but you can programatically change the value of the object by changing its value property. You can use hidden objects for client/server communication. Propertiesname reflects the NAME attribute value reflects the current value of the hidden object MethodsNone. Event handlersNone. 例子The following example uses a hidden object to store the value of the last object the user clicked. The form contains a "Display hidden value" button that the user can click to display the value of the hidden object in an Alert dialog box. Hidden object exampleClick some of these objects, then click the "Display value" button
to see the value of the last object clicked. Soul and R&B Jazz Classical Red Orange Yellow相关cookie property history objectContains information on the URLs that the client has visited within a window. This information is stored in a history list, and is accessible through the Navigator's Go menu. 语法To use a history object: 1. history.propertyName2. history.methodName(parameters)
propertyName is one of the properties listed below.
methodName is one of the methods listed below. Property ofdocument 描述The history object is a linked list of URLs the user has visited, as shown in the Navigator's Go menu. Propertieslength reflects the number of entries in the history object Methodsback forward go Event handlersNone. 例子Example 1. The following example goes to the URL the user visited three clicks ago in the current window. history.go(-3)Example 2. You can use the history object with a specific window or frame. The following example causes window2 to go back one item in its window (or session) history: window2.history.back()Example 3. The following example causes the second frame in a frameset to go back one item: parent.frames[1].history.back()Example 4. The following example causes the frame named frame1 in a frameset to go back one item: parent.frame1.history.back()Example 5. The following example causes the frame named frame2 in window2 to go back one item: window2.frame2.history.back()相关location object host propertyA string specifying the hostname:port portion of the URL. 语法1. links[index].host2. location.host
index is an integer representing a link object. Property oflink, location 描述The host property specifies a portion of the URL. 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 host property at any time, although it is safer to set the href property to change a location. If the host 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 and port. 例子See the 例子 for the href property. 相关hash, hostname, href, pathname, port, protocol, search properties hostname propertyA string specifying the host and domain name, or IP address, of a network host. 语法1. links[index].hostname2. location.hostname
index is an integer representing a link object. Property oflink, 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 propertyA string specifying the entire URL. 语法1. links[index].href2. location.href
index is an integer representing a link object. Property oflink, 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 window called msgWindow. newWindow=window.open ("http://home.netscape.com/comprod/products/navigator/ version_2.0/script/script_info/objects.htm#checkbox_object")msgWindow.document.write("newWindow.location.href = " + newWindow.location.href + "<P>")msgWindow.document.write("newWindow.location.protocol = " + newWindow.location.protocol + "<P>")msgWindow.document.write("newWindow.location.host = " + newWindow.location.host + "<P>")msgWindow.document.write("newWindow.location.hostName = " + newWindow.location.hostName + "<P>")msgWindow.document.write("newWindow.location.port = " + newWindow.location.port + "<P>")msgWindow.document.write("newWindow.location.pathname = " + newWindow.location.pathname + "<P>")msgWindow.document.write("newWindow.location.search = " + newWindow.location.search + "<P>")msgWindow.document.write("newWindow.location.hash = " + newWindow.location.hash + "<P>")msgWindow.document.close()
The previous example displays output such as the following: newWindow.location.href = http://home.netscape.com/comprod/products/navigator/ version_2.0/script/script_info/objects.htm#checkbox_objectnewWindow.location.protocol = http:newWindow.location.host = home.netscape.comnewWindow.location.hostName = home.netscape.comnewWindow.location.port = newWindow.location.pathname = /comprod/products/navigator/version_2.0/script/ script_info/objects.htmnewWindow.location.search = newWindow.location.hash = #checkbox_object
相关hash, host, hostname, pathname, port, protocol, search properties