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

📄 objects.html

📁 学习源代码
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<HTML>
<body background="ee.jpg">

<A NAME="objects"><H1>JavaScript的对象</H1></A>

<P>The following objects are available in JavaScript:
<TABLE width=70%>
<TR>
<TD>
<LI><A HREF=#anchor_object>anchor</A>
<LI><A HREF=#applet_object>applet</A>
<LI><A HREF=#button_object>button</A>
<LI><A HREF=#checkbox_object>checkbox</A>
<LI><A HREF=#Date_object>Date</A>
<LI><A HREF=#document_object>document</A>
<LI><A HREF=#form_object>form</A>
<LI><A HREF=#history_object>history</A>
<LI><A HREF=#link_object>link</A>
<LI><A HREF=#location_object>location</A>
</TD>
<TD>
<LI><A HREF=#Math_object>Math</A>
<LI><A HREF=#password_object>password</A>
<LI><A HREF=#radioButton_object>radioButton</A>
<LI><A HREF=#reset_object>reset</A>
<LI><A HREF=#selection_object>selection</A>
<LI><A HREF=#string_object>string</A>
<LI><A HREF=#submit_object>submit</A>
<LI><A HREF=#text_object>text</A>
<LI><A HREF=#textArea_object>textArea</A>
<LI><A HREF=#window_object>window</A>
</TD>
</TR>
</TABLE>

<P>
<b>NOTE:</b> Each object topic indicates whether the object is part of the client (in Navigator),
server (in LiveWire), or is common (built-in to JavaScript).
Server objects are not included in this version of the documentation.
 
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="anchor_object"><H2>anchor object (client)</H2></A>
<P>An anchor is a piece of text identified as the target of a hypertext link.


<H3>Syntax</H3>
<P>To define an anchor, use standard HTML syntax :
<PRE>
&LTA NAME="<I>anchorName</I>"
   <I>anchorText</I>
&LT/A>

</PRE>
<! xxx ->
<! xxx Brendan said to explain hash (#) a bit here. ->
<! xxx ->
<P><I>NAME</I> specifies a tag that becomes an available hypertext target within the current document.
<BR><I>anchorText</I> specifies the text to display at the anchor.


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

<P>xxx to be supplied


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


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


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


<H3>Examples</H3>
<XMP>
<A NAME="javascript_intro"><H2>Welcome to JavaScript</H2></A>
</XMP>


<H3>See also</H3>
<LI><A HREF=#link_object>link</A> object
<LI><A HREF="props.html#anchors_property" tppabs="http://www.webjx.com#anchors_property">anchors</A> property


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="applet_object"><H2>applet object (client)</H2></A>
<! xxx ->
<! xxx Rand will document the basics of the applet object when implemented. ->
<! xxx ->
<P>Represents a Java applet. xxx NYI.


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


<H3>Description</H3>
<! xxx ->
<! xxx Brendan suggests that the following paragraph go in the release notes instead. ->
<! xxx ->
<P>The applet object executes applets written in Java, not JavaScript. Java applets execute only on Netscape 2.0 and HotJava, and only on 32-bit platforms, such as Windows 95, Windows NT, and Unix. They do not execute on the 16-bit Windows platforms, such as Windows 3.1.


<H3>Properties</H3>
<LI><A HREF="props.html#length_property" tppabs="http://www.webjx.com#length_property">length</A>


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


<H3>Event handlers</H3>
<LI>xxx to be supplied


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


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


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


<H3>Syntax</H3>
<PRE>
&LTINPUT

   TYPE="button"
   NAME="<I>objectName</I>"
   VALUE="<I>buttonText</I>"
   [onClick="<I>handlerText</I>"]&GT

</PRE>
<I>NAME</I> specifies the name of the button object as a property of the enclosing form object and can be accessed using the name property.
<I>VALUE</I> specifies the label to display on the button face and can be accessed using the value property.

<H3>Description</H3>
<P>The button object is a custom button that you can use to perform an action you define.


<H3>Properties</H3>
<LI><A HREF="props.html#name_property" tppabs="http://www.webjx.com#name_property">name</A>
<LI><A HREF="props.html#value_property" tppabs="http://www.webjx.com#value_property">value</A>


<H3>Methods</H3>
<LI><A HREF="methods.html#click_method" tppabs="http://www.webjx.com#click_method">click</A>


<H3>Event handlers</H3>
<LI><A HREF="events.html#onClick_event" tppabs="http://www.webjx.com#onClick_event">onClick</A>


<H3>Examples</H3>
<P>A custom button does not necessarily load a new page into the client; it merely executes the script specified by the onClick event handler. In the following example, <I>myfunction()</I> is a JavaScript function.
<XMP>
<INPUT TYPE="button" VALUE="Calculate" NAME="calc_button"
   onClick="myfunction(this.form)">
</XMP>


<H3>See also</H3>
<LI><A HREF=#reset_object>reset</A> and <A HREF=#submit_object>submit</A> objects


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="checkbox_object"> <H2>checkbox object (client)</H2></A>
<P>A checkbox object is a checkbox on an HTML form. A checkbox is a toggle switch that lets the user set a value on or off.


<H3>Syntax</H3>
<P>To define a checkbox, use standard HTML syntax with the addition of the onClick event handler:
<PRE>&LTINPUT

   TYPE="checkbox"
   NAME="<I>objectName</I>"
   [CHECKED]
   [onClick="<I>handlerText</I>"]&GT

   <I>textToDisplay</I>
</PRE>


<H3>Description</H3>
<P>
Use the checked property to specify whether the checkbox is currently checked. Use the defaultChecked property to specify whether the checkbox is checked when the form is loaded.


<H3>Properties</H3>
<LI><A HREF="props.html#checked_property" tppabs="http://www.webjx.com#checked_property">checked</A>
<LI><A HREF="props.html#defaultChecked_property" tppabs="http://www.webjx.com#defaultChecked_property">defaultChecked</A>
<LI><A HREF="props.html#name_property" tppabs="http://www.webjx.com#name_property">name</A>
<LI><A HREF="props.html#value_property" tppabs="http://www.webjx.com#value_property">value</A>


<H3>Methods</H3>
<LI><A HREF="methods.html#click_method" tppabs="http://www.webjx.com#click_method">click</A>


<H3>Event handlers</H3>
<LI><A HREF="events.html#onClick_event" tppabs="http://www.webjx.com#onClick_event">onClick</A>


<H3>Examples</H3>
<XMP>
<B>Specify your music preferences (check all that apply):</B>
<BR><INPUT TYPE="checkbox" NAME="musicpref_rnb" CHECKED> R&B

<BR><INPUT TYPE="checkbox" NAME="musicpref_jazz" CHECKED> Jazz
<BR><INPUT TYPE="checkbox" NAME="musicpref_blues" CHECKED> Blues
<BR><INPUT TYPE="checkbox" NAME="musicpref_newage" CHECKED> New Age
</XMP>


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


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="Date_object"><H2>Date object (common)</H2></A>
<P>
JavaScript has a date object that enables you to work with dates and times.
JavaScript handles dates very similar to the way Java handles dates:
They have many of the same date methods, and both languages
store dates internally as the number of milliseconds since January 1, 1970 00:00:00.

<H3>Syntax</H3>
<P>To create a date object:
<PRE>
<I>varName</I> = new Date(<I>parameters</I>)
</PRE>
where <I>varName</I> is a JavaScript variable name for the date object being created;
it can be a new object or a property of an existing object.
<P>
The <I>parameters</I> for the Date constructor can be any of the following:
<UL>
<LI>Nothing: creates today's date and time.  For example,
<code>today = new Date()</code>
<LI>A string representing a date in the following form: 
"Month day, year hours:minutes:seconds".  For example,
<code>
Xmas95= new Date("December 25, 1995 13:30:00")
</code>
If you omit hours, minutes, or seconds, the value will be set to zero.

<LI>A set of integer values for year, month, and day.
For example,
<code>
Xmas95 = new Date(95,11,25)
</code>
<LI>A set of values for year, month, day, hour, minute, and seconds
For example,
<code>
Xmas95 = new Date(95,11,25,9,30,0)
</code>
</UL>
<P>
To use date methods:
<PRE>
<I>dateObj.methodName(parameters)</I>
</PRE>
<P>
Exceptions: The UTC and parse methods of date are static methods that you use as follows:
<pre>
Date.UTC(<i>params</i>)
Date.parse(<i>params</i>)
</pre>

<H3>Description</H3>
<P>JavaScript does not have a date data type. However, the date object and its methods 
enable you to work with dates and times in your applications.

<P>The date object has a large number of methods for setting, getting, and manipulating dates.


<H3>Properties</H3>
<P>None.


<H3>Methods</H3>
<LI><A HREF="methods.html#getDate_method" tppabs="http://www.webjx.com#getDate_method">getDate</A>
<LI><A HREF="methods.html#getDay_method" tppabs="http://www.webjx.com#getDay_method">getDay</A>
<LI><A HREF="methods.html#getHours_method" tppabs="http://www.webjx.com#getHours_method">getHours</A>
<LI><A HREF="methods.html#getMinutes_method" tppabs="http://www.webjx.com#getMinutes_method">getMinutes</A>
<LI><A HREF="methods.html#getMonth_method" tppabs="http://www.webjx.com#getMonth_method">getMonth</A>
<LI><A HREF="methods.html#getSeconds_method" tppabs="http://www.webjx.com#getSeconds_method">getSeconds</A>
<LI><A HREF="methods.html#getTime_method" tppabs="http://www.webjx.com#getTime_method">getTime</A>
<LI><A HREF="methods.html#getTimeZoneOffset_method" tppabs="http://www.webjx.com#getTimeZoneOffset_method">getTimeZoneoffset</A>
<LI><A HREF="methods.html#getYear_method" tppabs="http://www.webjx.com#getYear_method">getYear</A>
<LI><A HREF="methods.html#parse_method" tppabs="http://www.webjx.com#parse_method">parse</A>
<LI><A HREF="methods.html#setDate_method" tppabs="http://www.webjx.com#setDate_method">setDate</A>
<LI><A HREF="methods.html#setHours_method" tppabs="http://www.webjx.com#setHours_method">setHours</A>

⌨️ 快捷键说明

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