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

📄 methods.html

📁 一个经典的例子
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<PRE>dateObj.getHours()</PRE>
<P>
where <code>dateObj</code> is a date object.

<H3>Description</H3>
<P>
Returns the hour for the date object, an integer between 0 and 23.

<H3>Applies to</H3>
<P><A HREF="objects.html#Date_object" tppabs="http://www.webjx.com/js/objects.html#Date_object">Date</A>

<H3>Examples</H3>
<P>
The second statement below assigns the value 23 to the variable hours, based on the value of the date object Xmas95.
<PRE>
Xmas95 = new Date("December 25, 1995 23:15:00")
hours = Xmas95.getHours()
</PRE>


<H3>See also</H3>
<LI>xxx To be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getMinutes_method"><H2>getMinutes method</H2></A>
<H3>Syntax</H3>
<CODE>dateObjgetMinute() </CODE>
<P>
where <code>dateObj</code> is a date object.

<H3>Description</H3>
<P>
Returns the minutes in the date object, an integer between 0 and 59.

<H3>Applies to</H3>
<P><A HREF="objects.html#Date_object" tppabs="http://www.webjx.com/js/objects.html#Date_object">Date</A>

<H3>Examples</H3>
<P>
The second statement below assigns the value 15 to the variable minutes, based on the value of the date object Xmas95.
<PRE>
Xmas95 = new Date("December 25, 1995 23:15:00")
minutes = Xmas95.getMinutes()
</PRE>

<H3>See also</H3>
<LI>xxx To be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getMonth_method"><H2>getMonth method</H2></A>
<H3>Syntax</H3>
<CODE>dateObj.getMonth() </CODE>
<P>
where <code>dateObj</code> is a date object.

<H3>Description</H3>
<P>
Returns the month in the date object, an integer between zero and eleven. Zero corresponds to January, one to Februrary, and so on.

<H3>Applies to</H3>
<P><A HREF="objects.html#Date_object" tppabs="http://www.webjx.com/js/objects.html#Date_object">Date</A>

<H3>Examples</H3>
<P>
The second statement below assigns the value 11 to the variable month, based on the value of the date object Xmas95.
<PRE>
Xmas95 = new Date("December 25, 1995 23:15:00")
month = Xmas95.getDate()
</PRE>


<H3>See also</H3>
<LI>xxx To be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getSeconds_method"><H2>getSeconds method</H2></A>
<H3>Syntax</H3>
<P><CODE>dateObj.getSeconds() </CODE>
<P>
where <code>dateObj</code> is a date object.

<H3>Description</H3>
<P>
Returns the seconds in the current time, an integer between 0 and 59.

<H3>Applies to</H3>
<P><A HREF="objects.html#Date_object" tppabs="http://www.webjx.com/js/objects.html#Date_object">Date</A>

<H3>Examples</H3>
<P>
The second statement below assigns the value 30 to the variable secs, 
based on the value of the date object Xmas95.
<PRE>
Xmas95 = new Date("December 25, 1995 23:15:30")
secs = Xmas95.getSeconds()
</PRE>

<H3>See also</H3>
<LI>xxx To be supplied.

<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getTime_method"><H2>getTime method</H2></A>
<H3>Syntax</H3>
<CODE>dateObj.getTime() </CODE>
<P>
where <code>dateObj</code> is a date object.

<H3>Description</H3>
<P>
Returns the numeric value for the date object.
This number is the number of milliseconds since the epoch (1 January 1970 00:00:00)
You can use this method to help assign a date and time to another date object.

<H3>Applies to</H3>
<P><A HREF="objects.html#Date_object" tppabs="http://www.webjx.com/js/objects.html#Date_object">Date</A>

<H3>Examples</H3>
<P>
The following example assigns the date value of theBigDay to sameAsBigDay.

<PRE>
theBigDay = new Date("July 1, 1999")
sameAsBigDay = new Date();
sameAsBigDay.setTime(theBigDay.getTime())
</PRE>

<H3>See also</H3>
<LI>xxx To be supplied.

<!----------------------------------------------------------------->
<HR>
<A NAME="getTimezoneOffset_method"><H2>getTimezoneOffset method</H2></A>

<H3>Syntax</H3>
<CODE>dateObj.getTimezoneOffset()</CODE>
<P>
where <code>dateObj</code> is a date object.

<H3>Description</H3>
<P>
Return the time zone offset in minutes for the current locale, i.e. the 
difference between the local time and GMT. 
This value would be a constant except for daylight savings time. 

<H3>Applies to</H3>
<P><A HREF="objects.html#Date_object" tppabs="http://www.webjx.com/js/objects.html#Date_object">Date</A>

<H3>Examples</H3>

<PRE>
x = new Date();
currentTimeZoneOffsetInHours = x.getTimezoneOffset()/60;
</PRE>

<H3>See also</H3>
<LI>xxx To be supplied.

<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getYear_method"><H2>getYear method</H2></A>
<H3>Syntax</H3>
<P><PRE>getyear()</PRE>

<H3>Description</H3>
<P>
Returns the year in the date object, less 1900.

<H3>Applies to</H3>
<P><A HREF="objects.html#Date_object" tppabs="http://www.webjx.com/js/objects.html#Date_object">Date</A>

<H3>Examples</H3>
<P>
The second statement below assigns the value 95 to the variable year, based on the value of the date object Xmas95.
<PRE>
Xmas95 = new Date("December 25, 1995 23:15:00")
year = Xmas95.getYear()
</PRE>


<H3>See also</H3>
<LI>xxx To be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="go_method"><H2>go method</H2></A>
<P>
The argument delta is an integer. If <i>delta</i>&nbsp; is greater than zero, then it loads the URL that is that number of entries forward in the history list; otherwise, it loads the URL that is that number of entries backward in the history list.
<P>
The argument string is a string. Go to the newest history entry whose title or URL contains string as a substring; substring matching is case-insensitive.

<H3>Syntax</H3>
<PRE>go(delta | "string")</PRE>

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

<H3>Applies to</H3>
<P><A HREF="objects.html#history_object" tppabs="http://www.webjx.com/js/objects.html#history_object">history</A>

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

<H3>See also</H3>
<LI><A HREF=#back_method>back</A>, <A HREF=#forward_method>forward</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="indexOf_method"><H2>indexOf method</H2></A>
<P>
Returns the index within the calling string object of the first occurrence of the specified character, starting the search at <I>fromIndex</I>.

<H3>Syntax</H3>
<PRE>indexOf(<I>character</I>, [<I>fromIndex</I>])</PRE>
<P><I>character</I> is the character to search for.
<BR><I>fromIndex</I> is the location within the calling string to start the search from, any integer from 0 to string.length() - 1.

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

<H3>Applies to</H3>
<P><A HREF="objects.html#string_object" tppabs="http://www.webjx.com/js/objects.html#string_object">string</A>

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

<H3>See also</H3>
<LI><A HREF=#charAt_method>charAt</A>, <A HREF=#lastIndexOf_method>lastIndexOf</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="italics_method"><H2>italics method</H2></A>
<P>
Causes the calling string object to be italicized by surrounding it with HTML italics tags, <TT>  &ltI> ... &lt/I>.</TT>

<! xxx Check to see if the method name is "italic" or "italics" -->

<H3>Syntax</H3>
<PRE>italics()</PRE>
<B>NOTE:</b> For Beta4, use I() for this method.

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

<H3>Applies to</H3>
<P><A HREF="objects.html#string_object" tppabs="http://www.webjx.com/js/objects.html#string_object">string</A>

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

<H3>See also</H3>
<LI><A HREF=#blink_method>blink</A>, <A HREF=#bold_method>bold</A>, <A HREF=#strike_method>strike</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="lastIndexOf_method"><H2>lastIndexOf method</H2></A>
<P>
Returns the index within the calling string object of the last occurrence of the specified character. The calling string is searched backwards, starting at <I>fromIndex</I>.


<H3>Syntax</H3>
<PRE>indexOf(<I>character</I>, [<I>fromIndex</I>])</PRE>
<P><I>character</I> is the character to search for.
<BR><I>fromIndex</I> is the location within the calling string to start the search from, any integer from 0 to string.length() - 1.

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

<H3>Applies to</H3>
<P><A HREF="objects.html#string_object" tppabs="http://www.webjx.com/js/objects.html#string_object">string</A>

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

<H3>See also</H3>
<LI><A HREF=#charAt_method>charAt</A>, <A HREF=#indexOf_method>indexOf</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="link_method"><H2>link method</H2></A>
<P>
Causes the calling string object to be a hyperlink by surrounding it with HTML hyperlink tags, <TT> &ltA HREF=...&gt &lt/A>.</TT>


<H3>Syntax</H3>
<PRE>link(<I>location</I>)</PRE>
The argument to the method, <I>location</I>, should be a valid URL.

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

<H3>Applies to</H3>
<P><A HREF="objects.html#string_object" tppabs="http://www.webjx.com/js/objects.html#string_object">string</A>

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

<H3>See also</H3>
<LI><A HREF=#anchor_method>anchor</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="log_method"><H2>log method</H2></A>
<P>
Returns the natural logarithm (base <I>e</I>) of its argument.

<H3>Syntax</H3>
<PRE>log(<I>arg</I>)</PRE>

<H3>Applies to</H3>
<P><A HREF="objects.html#Math_object" tppabs="http://www.webjx.com/js/objects.html#Math_object">Math</A>

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

<H3>See also</H3>
<LI><A HREF=#exp_method>exp</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="max_method"><H2>max method</H2></A>
<P>
Returns the greater of its two arguments.

<H3>Syntax</H3>
<PRE>max(<I>arg1, arg2</I>)</PRE>

<H3>Applies to</H3>
<P><A HREF="objects.html#Math_object" tppabs="http://www.webjx.com/js/objects.html#Math_object">Math</A>

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

<H3>See also</H3>
<LI><A HREF=#min_method>min</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="min_method"><H2>min method</H2></A>
<P>
Returns the lesser of its two arguments.

<H3>Syntax</H3>
<PRE>min(<I>arg1, arg2</I>)</PRE>

<H3>Applies to</H3>
<P><A HREF="objects.html#Math_object" tppabs="http://www.webjx.com/js/objects.html#Math_object">Math</A>

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

<H3>See also</H3>
<LI><A HREF=#max_method>max</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="open_method"><H2>open method</H2></A>
<P>
For the window object, opens a new web browser window. xxx For the document object, description to be supplied.

<H3>Syntax</H3>
<P>The first form of the syntax is for the document object; the second form is for window.
<PRE>1. document.open("MIME type")
2. window.open("<I>URL</I>", "<I>windowName</I>", ["<I>windowFeatures</I>"])</PRE>
<P>
<I>URL</I> specifies the URL to open in the new window.
<BR><I>windowName</I> specifies a name for the window object being opened.
<BR><I>windowFeatures</I> is a comma-separated list of any of the following options and values:
<PRE>
   toolbar[=yes|no]|[=1|0]
   location[=yes|no]|[=1|0]
   directories[=yes|no]|[=1|0]
   status[=yes|no]|[=1|0]
   menubar[=yes|no]|[=1|0]
   scrollbars[=yes|no]|[=1|0]
   resizable[=yes|no]|[=1|0]
   copyhistory[=yes|no]|[=1|0]

⌨️ 快捷键说明

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