分享
 
 
 

javascript手冊-h

王朝html/css/js·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

hash property

A string beginning with a hash mark (#) that specifies an anchor name in the URL.

语法1. links[index].hash

2. location.hash

index is an integer representing a link object.

Property of

link, 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 object

A 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.propertyName

2. 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 of

form

描述

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.

Properties

name reflects the NAME attribute

value reflects the current value of the hidden object

Methods

None.

Event handlers

None.

例子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 example

Click 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 object

Contains 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.propertyName

2. history.methodName(parameters)

propertyName is one of the properties listed below.

methodName is one of the methods listed below.

Property of

document

描述

The history object is a linked list of URLs the user has visited, as shown in the Navigator's Go menu.

Properties

length reflects the number of entries in the history object

Methods

back

forward

go

Event handlers

None.

例子

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 property

A string specifying the hostname:port portion of the URL.

语法1. links[index].host

2. location.host

index is an integer representing a link object.

Property of

link, 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 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 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_object

newWindow.location.protocol = http:

newWindow.location.host = home.netscape.com

newWindow.location.hostName = home.netscape.com

newWindow.location.port =

newWindow.location.pathname =

/comprod/products/navigator/version_2.0/script/

script_info/objects.htm

newWindow.location.search =

newWindow.location.hash = #checkbox_object

相关

hash, host, hostname, pathname, port, protocol, search properties

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有