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

📄 append1.html

📁 javascript中文教程
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="form_object"><H2>form object (client)</H2> </A>
<P>A form lets users input text and make choices from form objects such as checkboxes, radio buttons, and selection lists. You can also use a form to post data to or retrieve data from a server.


<H3>Syntax</H3>
<P>To define a form, use standard HTML syntax with the addition of the onSubmit event handler:
<PRE>
&LTFORM
   NAME="<I>objectName</I>
   TARGET="<I>windowName</I>"
   ACTION="<I>serverURL</I>"
   METHOD=GET | POST
   [onSubmit="<I>handlerText</I>"]&GT
&LT/FORM&GT
</PRE>

<P><I>TARGET</I> specifies the window that form responses go to. When you submit a form with a TARGET attribute, instead of seeing the server's responses in the same window that contained the form, you see them in a (possibly new) window.
<BR><I>ACTION</I> specifies the URL of the server to which form field input information is sent.
<BR<I>METHOD</I> specifies how information is sent to the server specified by ACTION. GET (the default) appends the input information to the URL which on most receiving systems becomes the value of the environment variable <I>QUERY_STRING</I>. POST sends the input information in a data body which is available on <I>stdin</I> with the data length set in the environment variable <I>CONTENT_LENGTH</I>.


<H3>Description</H3>
<P>
Each form in a document corresponds to a distinct object.

<P>You can reference the form objects in your code by using the forms property of the document object. The forms property is an array that contains an entry for each form in a document.

<P>You can reference a form's elements in your code by using the elements property. The elements property is an array that contains an entry for each element (such as a checkbox, radioButton, or text object) in a form.


<H3>Properties</H3>
<LI><A HREF=props.html#action_property>action</A>
<LI><A HREF=props.html#elements_property>elements</A>
<LI><A HREF=props.html#method_property>method</A>
<LI><A HREF=props.html#name_property>name</A>
<LI><A HREF=props.html#target_property>target</A>


<H3>Methods</H3>
<LI><A HREF=methods.html#submit_method>submit</A>


<H3>Event handlers</H3>
<LI><A HREF=events.html#onSubmit_event>onSubmit</A>


<H3>Examples</H3>
<P>
xxx to be supplied


<H3>See also</H3>
<LI><A HREF=props.html#elements_property>elements</A>, <A HREF=props.html#forms_property>forms</A> properties

<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="history_object"><H2>history object (client)</H2> </A>
<! xxx ->
<! xxx Rand says: I haven't been able to get history to work, so don't worry too much about it for now. ->
<! xxx ->
<P>The history object contains information on the URLs that the client has visited. 
This information is stored in a history list, and is accessible through the Navigator's 
Go menu.


<H3>Syntax</H3>
<PRE>history.go(<I>delta</I>)</PRE>
<I>delta</I> is an integer representing the offset of the destination URL in the history list.


<H3>Description</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>
<! xxx ->
<! xxx back and forward properties were removed and might come back as previous and next. ->
<! xxx ->
<LI><A HREF=props.html#current_property>current</A>
<LI><A HREF=props.html#length_property>length</A>


<H3>Methods</H3>
<LI><A HREF=methods.html#back_method>back</A>
<LI><A HREF=methods.html#forward_method>forward</A>
<LI><A HREF=methods.html#go_method>go</A>


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


<H3>Examples</H3>
<P>The following example goes to the URL the user visited three clicks ago.
<XMP>history.go(-3)</XMP>


<H3>See also</H3>
<LI>xxx to be supplied


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="link_object"><H2>link object (client)</H2></A>
<P>A link is a piece of text identified as a hypertext link. When the user clicks the link text, the link hypertext reference is loaded into its target window.


<H3>Syntax</H3>
<! xxx ->
<! xxx HTML has a LINK tag. Should that be used here instead of the A tag? ->
<! xxx ->
<P>To define a link, use standard HTML syntax with the addition of the onClick and onMouseOver event handlers:
<PRE>
&LTA HREF=<I>locationOrURL</I>
   TARGET="<I>windowName</I>"
   [onClick="<I>handlerText</I>"]
   [onMouseOver="<I>handlerText</I>"]&GT
   <I>linkText</I>
&LT/A&GT
</PRE>
<P><I>HREF</I> identifies a destination anchor or URL.
<BR><I>TARGET</I> specifies the window that the link is loaded into.
<BR><I>linkText</I> is rendered as a hypertext link to the URL.


<H3>Description</H3>
<P>Each link object is a location object.

<P>You can reference the link objects in your code by using the links property of the document object. The links property is an array that contains an entry for each link in a document.


<H3>Properties</H3>
<LI><A HREF=props.html#target_property>target</A>


<H3>Methods</H3>
<LI>xxx to be supplied


<H3>Event handlers</H3>
<LI><A HREF=events.html#onClick_event>onClick</A>
<LI><A HREF=events.html#onMouseOver_event>onMouseOver</A>


<H3>Examples</H3>
<P>The following example creates a hypertext link to an anchor named <I>javascript_intro</I>.
<XMP>
<A HREF="#javascript_intro">Introduction to JavaScript</A>
</XMP>
<P>The following example creates a hypertext link to a URL.
<XMP>
<A HREF="http://www.netscape.com">Netscape Home Page</A>
</XMP>


<H3>See also</H3>
<LI><A HREF=#anchor_object>anchor</A> object
<LI><A HREF=props.html#links_property>links</A> property


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="location_object"><H2>location object (client)</H2> </A>
<P>The location object contains information on the current URL.


<H3>Syntax</H3>
<PRE>location.<I>property</I></PRE>
<I>property</I> is one of the properties listed below.


<H3>Description</H3>
<P>xxx to be supplied


<H3>Properties</H3>
<LI><A HREF=props.html#hash_property>hash</A>
<LI><A HREF=props.html#host_property>host</A>
<LI><A HREF=props.html#hostname_property>hostname</A>
<LI><A HREF=props.html#href_property>href</A>
<LI><A HREF=props.html#pathname_property>pathname</A>
<LI><A HREF=props.html#port_property>port</A>
<LI><A HREF=props.html#protocol_property>protocol</A>
<LI><A HREF=props.html#search_property>search</A>


<H3>Methods</H3>
<LI><A HREF=methods.html#assign_method>assign</A>
<LI><A HREF=methods.html#toString_method>toString</A>


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


<H3>Examples</H3>
<P>
xxx to be supplied


<H3>See also</H3>
<LI>xxx to be supplied


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="Math_object"><H2>Math object (common)</H2></A>
<P>The built-in Math object has properties and methods for mathematical constants and functions. For example, the Math object's PI property has the value of pi.


<H3>Syntax</H3>
<PRE>
Math.<I>propertyName</I>
or
Math.<I>methodName</I>(<I>parameters</I>)
</PRE>


<H3>Description</H3>
<P>You reference the constant PI as <TT>Math.PI</TT>. Constants are defined with the full precision of real numbers in JavaScript.
<P>
Similarly, you reference Math functions as methods. For example, the sine function is <TT>Math.sin(<I>argument</I>)</TT>, where <I>argument</I> is the argument.
<P>
It is often convenient to use the <B>with</B> statement when a section of code uses several Math constants and methods, so you don't have to type "Math" repeatedly. For example,
<PRE>
with Math {
   a = PI * r*r;
   y = r*sin(theta)
   x = r*cos(theta)
}
</PRE>


<H3>Properties</H3>
<LI><A HREF=props.html#E_property>E</A>
<LI><A HREF=props.html#LN10_property>LN10</A>
<LI><A HREF=props.html#LN2_property>LN2</A>
<LI><A HREF=props.html#PI_property>PI</A>
<LI><A HREF=props.html#SQRT1_2_property>SQRT1_2</A>
<LI><A HREF=props.html#SQRT2_property>SQRT2</A>


<H3>Methods</H3>
<LI><A HREF=methods.html#abs_method>abs</A>
<LI><A HREF=methods.html#acos_method>acos</A>
<LI><A HREF=methods.html#asin_method>asin</A>
<LI><A HREF=methods.html#atan_method>atan</A>
<LI><A HREF=methods.html#ceil_method>ceil</A>
<LI><A HREF=methods.html#cos_method>cos</A>
<LI><A HREF=methods.html#exp_method>exp</A>
<LI><A HREF=methods.html#floor_method>floor</A>
<LI><A HREF=methods.html#log_method>log</A>
<LI><A HREF=methods.html#max_method>max</A>
<LI><A HREF=methods.html#min_method>min</A>
<LI><A HREF=methods.html#pow_method>pow</A>
<LI><A HREF=methods.html#random_method>random</A>
<LI><A HREF=methods.html#round_method>round</A>
<LI><A HREF=methods.html#sin_method>sin</A>
<LI><A HREF=methods.html#sqrt_method>sqrt</A>
<LI><A HREF=methods.html#tan_method>tan</A>


<H3>Event handlers</H3>
<P>
None. Built-in objects do not have event handlers.


<H3>Examples</H3>
<P>xxx to be supplied


<H3>See also</H3>
<LI>xxx to be supplied


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="password_object"><H2>password object (client)</H2></A>
<! xxx ->
<! xxx Rand says: Do not document password now. It may go in later, but not now. ->
<! xxx ->
<P>A password object is a text field on an HTML form. When the user enters text into the field, asterisks (*) hide anything entered from view.


<H3>Syntax</H3>
<P>To define a password object, use standard HTML syntax:
<PRE>
&LTINPUT
   TYPE="password"
   NAME="<I>objectName</I>"
   [VALUE="<I>textValue</I>"]
   SIZE=<I>integer</I>
</PRE>


<H3>Description</H3>
<P>xxx to be supplied


<H3>Properties</H3>
<LI><A HREF=props.html#defaultValue_property>defaultValue</A>
<LI><A HREF=props.html#name_property>name</A>
<LI><A HREF=props.html#value_property>value</A>


<H3>Methods</H3>
<LI><A HREF=methods.html#focus_method>focus</A>
<LI><A HREF=methods.html#blur_method>blur</A>
<LI><A HREF=methods.html#select_method>select</A>


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


<H3>Examples</H3>
<P>
<XMP>
<B>Password:</B> <INPUT TYPE="password" NAME="password" VALUE="" SIZE=25>
</XMP>


<H3>See also</H3>
<LI>xxx to be supplied


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="radioButton_object"><H2>radioButton object (client)</H2></A>
<P>A radioButton object is a set of radio buttons on an HTML form. A set of radio buttons lets the user choose one item from a list.


<H3>Syntax</H3>
<P>To define a set of radio buttons, use standard HTML syntax with the addition of the onClick event handler:
<PRE>
&LTINPUT
   TYPE="radio"
   NAME="<I>objectName</I>"
   VALUE="<I>buttonValue</I>"
   [CHECKED]
   [onClick="<I>handlerText</I>"]&GT
   <I>textToDisplay</I>
</PRE>
<P><I>NAME</I> should contain the same value for all radio buttons in a group.


<H3>Description</H3>
<P>All radio buttons in a radio button group use the same name property. To access the individual radio buttons in your code, follow the object name with an index starting from zero, one for each button the same way you would for an array such as <I>forms</I>: <TT>document.forms[0].<I>objectName</I>[0]</TT> is the first, <TT>document.forms[0].<I>objectName</I>[1]</TT> is the second, etc.


<H3>Properties</H3>
<LI><A HREF=props.html#checked_property>checked</A>
<LI><A HREF=props.html#defaultChecked_property>defaultChecked</A>
<LI><A HREF=props.html#index_property>index</A>
<LI><A HREF=props.html#length_property>length</A>
<LI><A HREF=props.html#name_property>name</A>
<LI><A HREF=props.html#value_property>value</A>


<H3>Methods</H3>
<LI><A HREF=methods.html#click_method>click</A>


<H3>Event handlers</H3>
<LI><A HREF=events.html#onClick_event>onClick</A>


<H3>Examples</H3>
<P>
The following example defines a radio button group to choose among three catalogs. Each radio button is given the same name, <I>NAME="choice"</I>, forming a group of buttons for which only one choice can be selected. The example also defines a text field that defaults to what was chosen via the radio buttons but that allows the user to type a nonstandard catalog name as well. JavaScript automatically sets the catalog name input field based on the radio buttons.
<XMP>
<INPUT TYPE="text" NAME="catalog" SIZE="20">
<INPUT TYPE="radio" NAME="choice" VALUE="PRICEY"
   onClick="form.catalog.value = 'top-of-the-line'"> It's really great!
<INPUT TYPE="radio" NAME="choice" VALUE="MODEST"
   onClick="form.catalog.value = 'middle-of-the-road'"> It's pretty good.
<INPUT TYPE="radio" NAME="choice" VALUE="CHEAPO"
   onClick="form.catalog.value = 'bargain-basement'"> It stinks!
</XMP>


<H3>See also</H3>
<LI><A HREF=#selection_object>selection</A> object


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="reset_object"><H2>reset object (client)</H2></A>
<P>A reset object is a reset button on an HTML form.


<H3>Syntax</H3>
<P>To define a reset button, use standard HTML syntax with the addition of the onClick event handler:
<PRE>
&LTINPUT
   [NAME="<I>objectName</I>"]

⌨️ 快捷键说明

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