📄 methods.html
字号:
<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=#indexOf_method>indexOf</A>, <A HREF=#lastIndexOf_method>lastIndexOf</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="clear_method"><H2>clear method</H2></A>
<P>
Clears the window.
<H3>Syntax</H3>
<PRE>clear()</PRE>
<H3>Description</H3>
<P>xxx Description to be supplied.
<H3>Applies to</H3>
<P><A HREF="objects.html#document_object" tppabs="http://www.webjx.com/js/objects.html#document_object">document</A>
<H3>Examples</H3>
<P>xxx Examples to be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="clearTimeout_method"><H2>clearTimeout method</H2></A>
<P>Cancels a timeout that was set with the setTimeout method.
<H3>Syntax</H3>
<PRE>clearTimeout(<I>timeoutID</I>)</PRE>
<P><I>timeoutID</I> is a timeout setting that was returned by a previous call to the setTimeout method.
<H3>Description</H3>
<P>xxx Description to be supplied.
<! xxx See Brendan's email for more information.
<H3>Applies to</H3>
<P><A HREF="objects.html#window_object" tppabs="http://www.webjx.com/js/objects.html#window_object">window</A>
<H3>Examples</H3>
<P>xxx Examples to be supplied.
<H3>See also</H3>
<LI><A HREF=#setTimeout_method>setTimeout</A>
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="click_method"><H2>click method</H2></A>
<P>
Simulates a mouse click on the calling form element.
<H3>Syntax</H3>
<PRE>click()</PRE>
<H3>Description</H3>
<P>The effect of the click method varies according to the calling element:
<LI>For button, reset, and submit, xxx.
<LI>For a radioButton, selects a radio button.
<LI>For a checkbox, checks the check box and sets its value to on.
<LI>For a selection, sets its value.
<H3>Applies to</H3>
<P><A HREF="objects.html#button_object" tppabs="http://www.webjx.com/js/objects.html#button_object">button</A>, <A HREF="objects.html#checkbox_object" tppabs="http://www.webjx.com/js/objects.html#checkbox_object">checkbox</A>, <A HREF="objects.html#radioButton_object" tppabs="http://www.webjx.com/js/objects.html#radioButton_object">radioButton</A>, <A HREF="objects.html#reset_object" tppabs="http://www.webjx.com/js/objects.html#reset_object">reset</A>, <A HREF="objects.html#selection_object" tppabs="http://www.webjx.com/js/objects.html#selection_object">selection</A>, <A HREF="objects.html#submit_object" tppabs="http://www.webjx.com/js/objects.html#submit_object">submit</A>
<H3>Examples</H3>
<P>xxx Examples to be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="close_method"><H2>close method</H2></A>
<P>
For document and window, closes the window. xxx Not yet implemented in Beta 4.
<H3>Syntax</H3>
<PRE>close()</PRE>
<H3>Description</H3>
<P>Document description to be supplied.
<P>The close method closes the current window.
<H3>Applies to</H3>
<P><A HREF="objects.html#document_object" tppabs="http://www.webjx.com/js/objects.html#document_object">document</A>, <A HREF="objects.html#window_object" tppabs="http://www.webjx.com/js/objects.html#window_object">window</A>
<H3>Examples</H3>
<P>Any of the following examples close the current window:
<PRE>window.close()
self.close()
close()</PRE>
<H3>See also</H3>
<LI><A HREF=#open_method>open</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="confirm_method"><H2>confirm method</H2></A>
<P>
Displays a Confirm dialog box with the specified message and OK and Cancel buttons.
<H3>Syntax</H3>
<P>confirm("<I>message</I>")
<P>The argument <I>message</I> is any string.
<H3>Description</H3>
<P>Use the confirm method to ask the user to make a decision that requires either an OK or a Cancel. The <I>message</I> argument specifies a message that prompts the user for the decison. The confirm method returns true if the user chooses OK and false if the user chooses Cancel.
<H3>Applies to</H3>
<P><A HREF="objects.html#window_object" tppabs="http://www.webjx.com/js/objects.html#window_object">window</A>
<H3>Examples</H3>
<P>This example uses the confirm method in the confirmCleanUp function to confirm that the user of an application really wants to quit. If the user chooses OK, the custom cleanUp() function closes the application.
<PRE>
function confirmCleanUp() {
if (confirm("Are you sure you want to quit this application?")) {
cleanUp()
}
}</PRE>
You can call the confirmCleanUp function in the onClick event handler of a form's pushbutton, as shown in the following example:
<PRE><INPUT TYPE="button" VALUE="Quit" onClick="confirmCleanUp()"></PRE>
<H3>See also</H3>
<LI><A HREF=#alert_method>alert</A>, <A HREF=#prompt_method>prompt</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="cos_method"><H2>cos method</H2></A>
<P>
Returns the cosine of its argument. The argument is in radians.
<H3>Syntax</H3>
<PRE>cos(<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=#acos_method>acos</A>, <A HREF=#asin_method>asin</A>, <A HREF=#atan_method>atan</A>, <A HREF=#sin_method>sin</A>, <A HREF=#tan_method>tan</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="eval_method"> <H2>eval function</H2></A>
<P>
The eval function is a function built-in to JavaScript. It is not a method associated with any object, but is part of the language itself.
<H3>Syntax</H3>
<PRE>eval(<I>expression</I>)</PRE>
<H3>Description</H3>
<P>The eval function takes a JavaScript arthimetic expression as its argument and returns the value of the argument as a number.
<H3>Example</H3>
<P>Both of the uses of eval in the following example assign the value 42 to the variable result.
<PRE>x = 6
result = eval((3+3)*7)
result = eval(x*7)
</PRE>
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="exp_method"><H2>exp method</H2></A>
<P>
Returns <I>e</I> to the power of its argument, i.e. e<SUP>x</SUP>, where <I>x</I> is the argument, and <I>e</I> is Euler's constant, the base of the natural logarithms.
<H3>Syntax</H3>
<PRE>exp(<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=#log_method>log</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="fixed_method"><H2>fixed method</H2></A>
<P>
Causes the calling string object to be displayed in fixed-pitch font in HTML by surrounding it with typewriter text tags, <TT> <fixed> ... </fixed>.</TT>
<H3>Syntax</H3>
<PRE>fixed()</PRE>
<B>NOTE:</b> For Beta4, use TT() 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.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="floor_method"><H2>floor method</H2></A>
<P>
Returns the greatest integer less than or equal to its argument.
<H3>Syntax</H3>
<PRE>floor(<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=#ceil_method>ceil</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="focus_method"><H2>focus method</H2></A>
<P>
For password, text, and textArea, gives focus to the object.
<H3>Syntax</H3>
<PRE>focus()</PRE>
<H3>Description</H3>
<P>Use the focus method to navigate to a specific form element and give it focus. You can then either programatically enter a value in the element or let the user enter a value.
<H3>Applies to</H3>
<P><A HREF="objects.html#password_object" tppabs="http://www.webjx.com/js/objects.html#password_object">password</A>, <A HREF="objects.html#text_object" tppabs="http://www.webjx.com/js/objects.html#text_object">text</A>, <A HREF="objects.html#textArea_object" tppabs="http://www.webjx.com/js/objects.html#textArea_object">textArea</A>
<H3>Examples</H3>
<P>In the following example, the checkPassword function confirms that a user has entered a valid password. If the password is not valid, the focus method returns focus to the password field and the select method highlights it so the user can re-enter the password.
<PRE>
function checkPassword(userPass) {
if (badPassword) {
alert("Please enter your password again.")
userPass.focus()
userPass.select()
}
}</PRE>
This example assumes that the password is defined as:
<PRE><INPUT TYPE=password NAME=userPass></PRE>
<H3>See also</H3>
<LI><A HREF=#blur_method>blur</A>, <A HREF=#select_method>select</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="fontcolor_method"><H2>fontcolor method</H2></A>
<P>
Causes the calling string object to be displayed in the specified color by surrounding it with HTML font color tags, <TT> <FONTCOLOR=color> ... </FONTCOLOR>.</TT>
<H3>Syntax</H3>
<PRE>fontcolor(<I>color</I>)</PRE>
<P>The argument to the method, <I>color</I>, must be a string containing a hashmark (#) followed by a triplet of hexadecimal number pairs. These three pairs represent the red, green, and blue values for the desired color, respectively.
<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.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="fontsize_method"><H2>fontsize method</H2></A>
<P>
Causes the calling string object to be displayed in the specified font size by surrounding it with HTML font size tags, <TT> <FONTSIZE=size> ... </FONTSIZE>.</TT>
<H3>Syntax</H3>
<PRE>fontsize(<I>size</I>)</PRE>
<P>The argument to the method, <I>size</I>, must be an integer between one and seven.
<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=#big_method>big</A>, <A HREF=#small_method>small</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="forward_method"><H2>forward method</H2></A>
<P>
Loads the next URL in the history list.
<H3>Syntax</H3>
<PRE>forward()</PRE>
<H3>Description</H3>
<P>This method performs the same action as a user choosing the Forward button in the Navigator. The forward method is the same as <TT>go(1)</TT>.
<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=#go_method>go</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getDate_method"><H2>getDate method</H2></A>
<H3>Syntax</H3>
<CODE>dateObj.getDate()</CODE>
<P>
where <code>dateObj</code> is a date object.
<H3>Description</H3>
<P>Returns the day of the month for the date object, an integer between 1 and 31.
<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 25 to the variable day, based on the value of the date object Xmas95.
<PRE>
Xmas95 = new Date("December 25, 1995 23:15:00")
day = Xmas95.getDate()
</PRE>
<H3>See also</H3>
<LI>xxx To be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getDay_method"><H2>getDay method</H2></A>
<H3>Syntax</H3>
<CODE>dateObj.getDay() </CODE>
<P>
where <code>dateObj</code> is a date object.
<H3>Description</H3>
<P>
Returns the day of the week for the date object, an integer corresponding
to the day of the week: zero for Sunday, one for Monday, two for Tuesday,
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 1 to weekday,
based on the value of the date object Xmas95. This is because December 25, 1995 is a Monday.
<PRE>
Xmas95 = new Date("December 25, 1995 23:15:00")
weekday = Xmas95.getDay()
</PRE>
<H3>See also</H3>
<LI>xxx To be supplied.
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="getHours_method"><H2>getHours method</H2></A>
<H3>Syntax</H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -