⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ref_h-l.htm

📁 javascript函数大全HTML javascript函数大全HTML
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<htm><title>网络时空——网页制作</title>
<link rel="shortcut icon" href="../../../../ccisn.ico">
<link href="../../../../common.css" type="text/css" rel="stylesheet"><style type="text/css">
<!--
td,p,div {font-size:9pt;font-family:宋体;}
BODY { font-family:宋体; margin-left:0; margin-top:0; font-size:9pt; background-color:#ffffff;}
A { font-size: 9pt;color:#0000aa; text-decoration:underline;font-family:宋体; }
A:hover,A:active{ color:#FF8019; text-decoration:underline;}
A.top{color:#ffffff;font-size:9pt}
-->
</style>
<body bgcolor="#ffffff" text="#000000" link="#003399" alink="#ff9900" vlink="#000000" background="../../../images/b01.jpg">
<A NAME="hash_property"><H2>hash property</H2></A>
<P>
A string beginning with a hash mark (#) that specifies an anchor name in the URL.

<H3>语法</H3>
<PRE>
1. links[<I>index</I>].hash
2. location.hash
</PRE>
<P><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_h-l.htm#link_object" link_object">link</A>, <A HREF="ref_h-l.htm#location_object" location_object">location</A>

<H3>描述</H3>
<P>The hash property specifies a portion of the URL.

<P>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.

<P>See <A HREF="tppmsgs/msgs0.htm#12" tppabs="http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.htm" TARGET="_top">RFC 1738</A> for complete information about the hash.

<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_a-c.htm#anchor_object" anchor_object">anchor</A> object and the <A HREF="ref_h-l.htm#href_property" href_property">href</A> property.

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#host_property" host_property">host</A>, <A HREF="ref_h-l.htm#hostname_property" hostname_property">hostname</A>, <A HREF="ref_h-l.htm#href_property" href_property">href</A>, <A HREF="ref_m-q.htm#pathname_property" pathname_property">pathname</A>, <A HREF="ref_m-q.htm#port_property" port_property">port</A>, <A HREF="ref_m-q.htm#protocol_property" protocol_property">protocol</A>, <A HREF="ref_s-s.htm#search_property" search_property">search</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="hidden_object"><H2>hidden object</H2></A>
<P>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.


<H3>语法</H3>
<P>To define a hidden object:
<PRE>
&LTINPUT
   TYPE="hidden"
   NAME="<I>hiddenName</I>"
   [VALUE="<I>textValue</I>"]&GT
</PRE>
<I>NAME="hiddenName"</I> specifies the name of the hidden object. You can access this value using the name property.
<BR><I>VALUE="textValue"</I> specifies the initial value of the hidden object.

<P>To use a hidden object's properties:
<PRE>
1. <I>hiddenName</I>.<I>propertyName</I>
2. <I>formName</I>.elements[<I>index</I>].<I>propertyName</I>
</PRE>
<I>hiddenName</I> is the value of the NAME attribute of a hidden object.
<BR><I>formName</I> is either the value of the NAME attribute of a form object or an element in the <I>forms</I> array.
<BR><I>index</I> is an integer representing a hidden object on a form.
<BR><I>propertyName</I> is one of the properties listed below.


<H3>Property of</H3>
<LI><A HREF="ref_f-g.htm#form_object" form_object">form</A>


<H3>描述</H3>
<P>A hidden object is a form element and must be defined within a &LTFORM&GT tag.

<P>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.


<H3>Properties</H3>
<LI><A HREF="ref_m-q.htm#name_property" name_property">name</A> reflects the NAME attribute
<LI><A HREF="ref_t-z.htm#value_property" value_property">value</A> reflects the current value of the hidden object


<H3>Methods</H3>
<LI>None.


<H3>Event handlers</H3>
<LI>None.


<H3>例子</H3>
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.
<XMP>
<htm>
<HEAD>
<TITLE>Hidden object example</TITLE>
</HEAD>
<BODY>
<B>Click some of these objects, then click the "Display value" button
<BR>to see the value of the last object clicked.</B>
<FORM NAME="form1">
<INPUT TYPE="hidden" NAME="hiddenObject" VALUE="None">
<P>
<INPUT TYPE="button" VALUE="Click me" NAME="button1" 
   onClick="document.form1.hiddenObject.value=this.value">
<P>
<INPUT TYPE="radio" NAME="musicChoice" VALUE="soul-and-r&b"
   onClick="document.form1.hiddenObject.value=this.value"> Soul and R&B
<INPUT TYPE="radio" NAME="musicChoice" VALUE="jazz"
   onClick="document.form1.hiddenObject.value=this.value"> Jazz
<INPUT TYPE="radio" NAME="musicChoice" VALUE="classical"
   onClick="document.form1.hiddenObject.value=this.value"> Classical
<P>
<SELECT NAME="music_type_single"
   onFocus="document.form1.hiddenObject.value=this.options[this.selectedIndex].text">
   <OPTION SELECTED> Red <OPTION> Orange <OPTION> Yellow
</SELECT>
<P><INPUT TYPE="button" VALUE="Display hidden value" NAME="button2"
   onClick="alert('Last object clicked: ' + document.form1.hiddenObject.value)">
</FORM>
</BODY>
</htm>
</XMP>


<H3>相关</H3>
<LI><A HREF="ref_a-c.htm#cookie_property" cookie_property">cookie</A> property


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="history_object"><H2>history object</H2> </A>
<P>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.

<H3>语法</H3>
<P>To use a history object:
<PRE>
1. history.<I>propertyName</I>
2. history.<I>methodName</I>(<I>parameters</I>)
</PRE>
<I>propertyName</I> is one of the properties listed below.
<BR><I>methodName</I> is one of the methods listed below.


<H3>Property of</H3>
<LI><A HREF="ref_d-e.htm#document_object" document_object">document</A>


<H3>描述</H3>
<P>The history object is a linked list of URLs the user has visited, as shown in the Navigator's Go menu.


<H3>Properties</H3>
<LI><A HREF="ref_h-l.htm#length_property" length_property">length</A> reflects the number of entries in the history object


<H3>Methods</H3>
<LI><A HREF="ref_a-c.htm#back_method" back_method">back</A>
<LI><A HREF="ref_f-g.htm#forward_method" forward_method">forward</A>
<LI><A HREF="ref_f-g.htm#go_method" go_method">go</A>


<H3>Event handlers</H3>
<LI>None.


<H3>例子</H3>
<P><B>Example 1.</B> The following example goes to the URL the user visited three clicks ago in the current window.
<XMP>history.go(-3)</XMP>

<P><B>Example 2.</B> You can use the history object with a specific window or frame. The following example causes <I>window2</I> to go back one item in its window (or session) history:
<XMP>window2.history.back()</XMP>

<P><B>Example 3.</B> The following example causes the second frame in a frameset to go back one item:
<XMP>parent.frames[1].history.back()</XMP>

<P><B>Example 4.</B> The following example causes the frame named <I>frame1</I> in a frameset to go back one item:
<XMP>parent.frame1.history.back()</XMP>

<P><B>Example 5.</B> The following example causes the frame named <I>frame2</I> in <I>window2</I> to go back one item:
<XMP>window2.frame2.history.back()</XMP>

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#location_object" location_object">location</A> object


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="host_property"><H2>host property</H2></A>
<P>
A string specifying the hostname:port portion of the URL.

<H3>语法</H3>
<PRE>
1. links[<I>index</I>].host
2. location.host
</PRE>
<P><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_h-l.htm#link_object" link_object">link</A>, <A HREF="ref_h-l.htm#location_object" location_object">location</A>

<H3>描述</H3>
<P>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.

<P>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.

<P>See Section 3.1 of <A HREF="tppmsgs/msgs0.htm#12" tppabs="http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.htm" TARGET="_top">RFC 1738</A> for complete information about the hostname and port.

<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_h-l.htm#href_property" href_property">href</A> property.

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#hash_property" hash_property">hash</A>, <A HREF="ref_h-l.htm#hostname_property" hostname_property">hostname</A>, <A HREF="ref_h-l.htm#href_property" href_property">href</A>, <A HREF="ref_m-q.htm#pathname_property" pathname_property">pathname</A>, <A HREF="ref_m-q.htm#port_property" port_property">port</A>, <A HREF="ref_m-q.htm#protocol_property" protocol_property">protocol</A>, <A HREF="ref_s-s.htm#search_property" search_property">search</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="hostname_property"><H2>hostname property</H2></A>
<P>
A string specifying the host and domain name, or IP address, of a network host.

<H3>语法</H3>
<PRE>
1. links[<I>index</I>].hostname
2. location.hostname
</PRE>
<P><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_h-l.htm#link_object" link_object">link</A>, <A HREF="ref_h-l.htm#location_object" location_object">location</A>

<H3>描述</H3>
<P>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.

<P>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.

<P>See Section 3.1 of <A HREF="tppmsgs/msgs0.htm#12" tppabs="http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.htm" TARGET="_top">RFC 1738</A> for complete information about the hostname.

<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_h-l.htm#href_property" href_property">href</A> property.

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#hash_property" hash_property">hash</A>, <A HREF="ref_h-l.htm#host_property" host_property">host</A>, <A HREF="ref_h-l.htm#href_property" href_property">href</A>, <A HREF="ref_m-q.htm#pathname_property" pathname_property">pathname</A>, <A HREF="ref_m-q.htm#port_property" port_property">port</A>, <A HREF="ref_m-q.htm#protocol_property" protocol_property">protocol</A>, <A HREF="ref_s-s.htm#search_property" search_property">search</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="href_property"><H2>href property</H2></A>
<P>
A string specifying the entire URL.

<H3>语法</H3>
<PRE>
1. links[<I>index</I>].href
2. location.href
</PRE>
<P><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_h-l.htm#link_object" link_object">link</A>, <A HREF="ref_h-l.htm#location_object" location_object">location</A>

<H3>描述</H3>
<P>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.

<P>Omitting a property name from the location object is equivalent to specifying <TT>location.href</TT>. For example, the following two statements are equivalent and set the URL of the current window to the Netscape home page:
<XMP>
window.location.href="http://www.netscape.com/"
window.location="http://www.netscape.com/"
</XMP>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -