
常用软件类: |
|杀毒安全 | |联络聊天 | |网络软件 | |多媒体类 | |系统工具 | |图形图像 | |系统工具 | |应用软件 | |行业软件 |
开发设计类: |
|动画制作 | |图像处理 | |3D设计 | |操作系统 | |站长学院 | |网络相关 | |WEB设计 | |数据库类 | |程序开发 |
以下的一些"方法"可用在JavaScript:
|
|
|
|
|
|
Returns the absolute value of its argument.
abs(arg)
Math
xxx Examples to be supplied.
Returns the arc cosine (in radians) of its argument.
acos(arg)
Math
xxx Examples to be supplied.
Displays an Alert dialog box with a message and an OK button.
alert("message")
The argument message is any string.
Use the alert method to display a message that does not require a user decision. The message argument specifies a message that the dialog box contains.
window
In the following example, the testValue function checks the name entered by a user in the text element of a form to make sure that it is no more than eight characters in length. This example uses the alert method to prompt the user of an application to enter a valid value.
function testValue(textElement) {
if (textElement.length > 8) {
alert("Please enter a name that is 8 characters or less")
}
}You can call the testValue function in the onBlur event handler of a form's text element, as shown in the following example: Name: <INPUT TYPE="text" NAME="userName" onBlur="testValue(userName)">
Causes the calling string object to be a named anchor by surrounding it with HTML anchor tags, <A NAME=...> </A>.
string.anchor(name)
The argument name can be any string.
xxx Description to be supplied.
string
xxx Examples to be supplied.
Returns the arc sine (in radians) of its argument.
asin(arg)
Math
xxx Examples to be supplied.
Sets location.href so you don't have to type ".href" complements toString().
assign()
Do not call the assign method. It exists so you can use 'location=...' instead of 'location.href=...'. xxx Description to be supplied.
location
xxx Examples to be supplied.
Returns the arc tangent (in radians) of its argument.
atan(arg)
Math
xxx Examples to be supplied.
Loads the previous URL in the history list.
back()
This method performs the same action as a user choosing the Back button in the Navigator. The back method is the same as go(-1).
history
xxx Examples to be supplied.
Causes the calling string object to be displayed in big font by surrounding it with HTML big font tags, <BIG> and </BIG>.
big()
xxx Description to be supplied.
string
xxx Examples to be supplied.
Causes the calling string object to blink by surrounding it with HTML blink tags, <BLINK> ... </BLINK>.
blink()
xxx Description to be supplied.
string
xxx Examples to be supplied.
For password, text, and textArea, removes focus to the object.
blur()
Use the blur method to remove focus from a specific form element.
password, text, textArea
xxx Examples to be supplied.
Causes the calling string object to be displayed as bold by surrounding it with HTML bold tags, <B> ... </B>.
bold()NOTE: For Beta4, use B() for this method.
xxx Description to be supplied.
string
xxx Examples to be supplied.
Returns the least integer greater than or equal to its argument.
ceil(arg)
Math
xxx Examples to be supplied.
Returns the character at the specified index.
charAt(index)
index is any integer from 0 to string.length() - 1.
xxx Description to be supplied.
string
xxx Examples to be supplied.
Clears the window.
clear()
xxx Description to be supplied.
document
xxx Examples to be supplied.
Cancels a timeout that was set with the setTimeout method.
clearTimeout(timeoutID)
timeoutID is a timeout setting that was returned by a previous call to the setTimeout method.
xxx Description to be supplied. Applies to
window
xxx Examples to be supplied.
Simulates a mouse click on the calling form element.
click()
The effect of the click method varies according to the calling element:
button, checkbox, radioButton, reset, selection, submit
xxx Examples to be supplied.
For document and window, closes the window. xxx Not yet implemented in Beta 4.
close()
Document description to be supplied.
The close method closes the current window.
document, window
Any of the following examples close the current window:
window.close() self.close() close()
Displays a Confirm dialog box with the specified message and OK and Cancel buttons.
confirm("message")
The argument message is any string.
Use the confirm method to ask the user to make a decision that requires either an OK or a Cancel. The message 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.
window
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.
function confirmCleanUp() {
if (confirm("Are you sure you want to quit this application?")) {
cleanUp()
}
}You can call the confirmCleanUp function in the onClick event handler of a form's pushbutton, as shown in the following example: <INPUT TYPE="button" VALUE="Quit" onClick="confirmCleanUp()">
Returns the cosine of its argument. The argument is in radians.
cos(arg)
Math
xxx Examples to be supplied.
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.
eval(expression)
The eval function takes a JavaScript arthimetic expression as its argument and returns the value of the argument as a number.
Both of the uses of eval in the following example assign the value 42 to the variable result.
x = 6 result = eval((3+3)*7) result = eval(x*7)
Returns e to the power of its argument, i.e. ex, where x is the argument, and e is Euler's constant, the base of the natural logarithms.
exp(arg)
Math
xxx Examples to be supplied.
Causes the calling string object to be displayed in fixed-pitch font in HTML by surrounding it with typewriter text tags, <fixed> ... </fixed>.
fixed()NOTE: For Beta4, use TT() for this method.
xxx Description to be supplied.
string
xxx Examples to be supplied.
Returns the greatest integer less than or equal to its argument.
floor(arg)
Math
xxx Examples to be supplied.
For password, text, and textArea, gives focus to the object.
focus()
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.
password, text, textArea
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.
function checkPassword(userPass) {
if (badPassword) {
alert("Please enter your password again.")
userPass.focus()
userPass.select()
}
}This example assumes that the password is defined as: <INPUT TYPE=password NAME=userPass>
Causes the calling string object to be displayed in the specified color by surrounding it with HTML font color tags, <FONTCOLOR=color> ... </FONTCOLOR>.
fontcolor(color)
The argument to the method, color, 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.
xxx Description to be supplied.
string
xxx Examples to be supplied.
Causes the calling string object to be displayed in the specified font size by surrounding it with HTML font size tags, <FONTSIZE=size> ... </FONTSIZE>.
fontsize(size)
The argument to the method, size, must be an integer between one and seven.
xxx Description to be supplied.
string
xxx Examples to be supplied.