Javascript objects and Arrays

Source: Internet
Author: User
Tags close close mathematical constants gopher natural logarithm time in milliseconds
Select blog from xieyj

This article lists various JavaScript objects and arrays, including a brief description of each of the above objects or arrays, as well as the relevant attribute methods, and event processing. Program Also, the parent Object User indicating the object or array may also need to refer to the Super Text object hierarchy page (http://www.netscapepress.com/support/javascript/10-9.htm) in online companion to see how these objects are correlated.
By the way, remember to regard all the objects that serve as sub-objects of another object as the attributes of this object. For more information, see the related annotations in chapter 10.

B .1 anchor object
A link can be used as a target for the HTML lookup created with the <a name => flag. If the anchor includes the href = feature, it is also a link object.
An anchor object is an attribute of a document object. It does not have an attribute method or an event handler.

B .2 anchors Array
The anchors array is an attribute of the Document Object and a list of all anchor objects in the document. If anchor is also a link, it will appear in the anchors and links arrays at the same time.
Attribute
Length

B .3 array object
An array object is a new object introduced in Netscape navlgator 3.0 Beta 3. Therefore, it cannot be used in Netscape 2.0 as a built-in object, rather than the attributes of other objects.
Attribute
Number of values in the length Array

B .4 Button Object
It is an attribute of the form object and is created using the <input type = "button"> mark.
Attribute
Name = feature in name HTML Tag
Value = feature in value HTML Tag
Method
Click simulate mouse click a button
Event Handler
Onclick

B .5 checkbox object
It is an attribute of the form object and is created using the <input type = "checkbox"> mark.
Attribute
Select status of the checked check box
Checkultchecked mark checked = feature
Name = feature
Value = feature of value tag
Method
Click simulate mouse click button
Event Handler
Onclick

B .6 date object
It is a built-in object, rather than the attributes of other objects, allowing users to execute various processes that use date and time.
Method
Getdate (): view the date object and return the date
Getday () returns the day of the week
Gethours () return hours
Getminutes () returns the number of minutes
Getmonth () returns the month value.
Getseconds () returns the number of seconds
Gettime () returns the complete time
Gettimezoneoffset () returns the time zone deviation (the number of hours between the mean Greenwich Mean Time and the time zone setting of the computer running the script)
Getyear () returns the year
Parse () returns the number of milliseconds since 00:00:00, January 1, January 1, 1970 in the date string (the date object stores the date and time since in milliseconds). However, note that, this method cannot run correctly currently
Setdate () changes the date of the date object
Sethours () change the hour
Setminutes () changes the number of minutes
Setmonth () Change month
Setseconds () changed in seconds
Settime () changes the complete time
Setyear () changes the year
Togmtstring () converts the date object's date (a value) into a GMT time string and returns a value similar to the following: WEDS, 15 June l997 14:02:02 GMT (the exact format depends on the operating system running on the computer)
Tolocalestring () converts the date (a value) of the date object into a string and uses the specified date format configured on the computer where it is located.
UTC () uses date UTC (year, month, day, hour, minute, second), and is optional since January 1, 1970 00:00:00) returns the date in milliseconds.

B .7 Document Object
This object is an attribute of the window and frames objects. It is a document displayed in a window or frame.
Attribute
Alinkcolor activity link color (alink)
Anchor is an htmi anchor. It is created with the <a name => MARK (this attribute is also an object)
Anchors array lists the array of document anchors (<a name =>) (This attribute is also an object)
Bgcolor (bgcolor)
Cookie is a piece of information stored in the cookie.txt file. It is an attribute of the Document Object.
Text color of the fgcolor document (text features in the <body> MARK)
Form (<form>) (This attribute is also an object)
Forms Anay lists an array of form objects in the order they appear in the document (this attribute is also an object)
Lastmodified document last modification date
The link color of the linkcolor document, that is, the link feature in the <body> MARK (link to the document not observed by the user)
A <a href => mark in the Link document (this attribute is also an object)
An array of link objects in the links array document, arranged in the order they appear in the document (this attribute is also an object)
Location: the URL of the currently displayed document. You cannot change document. Location (because this is the location of the currently displayed document ). However, you can change window. Location (Replace the current document with other documents). Window. Location is an object, and document. location is not an object.
The URL of the document whose referrer contains the link. You can click this link to reach the current document.
Title document title (title>)
Vlinkcolor points to the link text color of the document you have observed, that is, the <body> marked vlink feature
Method
Clear the content of a specified document
Close close Document Stream
Open Document Stream
Write writes text to the document
Writeln writes text to the document and ends with a linefeed.

B .8 elements array
it is an attribute of the form object and lists an array of elements in the form.
attribute
1. Number of elements in the ength form
B .9 form object
it is an attribute of the Document Object and a form in the document.
attribute
action contains a string of the target URL submitted for a form.
a button in the button form, use the tag to create a checkbox (this attribute is also an object).
check box, use the tag to create (this attribute is also an object)
elements array is an array, list the elements of each form in the order they appear in the form (this attribute is also an object)
mime encoding of the encoding form
A hidden element () in the hidden form ). An attribute of a form object (this attribute is also an object)
Number of elements in the length form
method: the data in the input form is transmitted to the server, that is, the method feature in the form flag
radio button set in the form () (This attribute is also an object)
Reset button in the reset form (1 nput type = "Reset">) (This attribute itself is also an object)
select box in select form () (This attribute is also an object) submit button in submit form () (This attribute is also an object)
after the target submits the form, name of the window showing the Response Information
text elements in the text form () (This attribute is also an object)
the partition element () in the textarta form (this attribute is also an object)
method
submit form (same as using the submit button) event handler
onsubmit

B .10 forms Array
This array is an attribute of the Document Object. It lists an array of forms in the document.
Attribute
Number of forms in the length document

B .11 frame object
It is an attribute of the window object and a framework in the window. Except for some exceptions, the frame object and the window object share the same role.
Attribute
Frames array lists an array of child frameworks in the framework (the attribute itself is also an object)
Length the number of frames in the framework.
Name framework name (name feature in the <frame> tag)
Parent includes synonyms of the parent window of the framework
Synonym for self's current framework
Synonyms of the current window frame
Method
Cleartimeout () is used to terminate the work of the setTimeout method.
SetTimeout () waits for the specified number of milliseconds and then runs the command

B .12 frames Array
It is both a window object and a frame object attribute. It lists the frames in a window or frame object.
Attribute
The number of frames in the length window or frame object.

B .13 hidden object
Paste as an attribute of the form object, and a hidden element in the form (<input type = "hidden"> ).
Attribute
Name in the name tag (name feature)
Value = feature in the value mark

B .14 History Object
It is an attribute of the window object, the Historical List of the window.
Attribute
Number of projects in the length history list
Method
Back load the previous document in the history list
Forward loads the next document in the history list
Go loads a specified document in the history list and specifies the position of the document in the list.

B .15 image object
It is an attribute of the Document Object and an image embedded in the document with (1 mg) Mark. This is a new object introduced by Netscape Navigator 3.0 Beta 3.
Attribute
Border MARK border features
Complete indicates whether the browser fully loads a Boolean value of the image
Height height
Features
Lowsrc features
SRC features
Vspace features
Width width
Event Handler
Onload image loading
Onerror loading error
Onabort canceled

B .16 images Array
It is an attribute of the document object, a list of all images in the document.
Attribute
Number of images in the length document

B .17 Link
It is an attribute of the Document Object and a <a href => mark in the document.
Attribute
Hash is a string starting with a hash (#). It is used to specify an anchor in a URL.
Host includes the Host Name of the URL of the colon and port number.
The hostname and host attributes are the same, except for the colon and port number.
Complete HREF URL
Pathname URL directory
Port URL: Port
Protocol URL type (http:, ftp:, gopher:, etc)
A part of the URL starting with a question mark. It is used to specify the search information.
Target: When you click a link (Target Feature), the window used to display the content of the referenced document
Event Handler
Onclick
Onmouseover move the mouse over the object

B .18 links Array
It is an attribute of the Document Object and a list of all links in the document.
Attribute
Number of links in the length document

B .19 location object
It is an attribute of the Document Object. The complete URL of this document should not be associated with window. the location attribute is obfuscated. The latter can be used to load a new document and window. the location property itself is not an object. At the same time, window. location can be modified using a script, while document. location is not supported.
Attribute
Hash is a string starting with a hash (#). It is used to specify an anchor in a URL.
Host includes the Host Name of the URL of the colon and port number.
The hostname and host attributes are the same, except for the colon and port number.
Complete HREF URL
Pathname URL directory
Port URL: Port
Protocol URL type (http:, ftp:, gopher:, etc)
Search with question mark (?) Part of the starting URL, used to specify the search information
When a target user clicks a link (Target Feature), the window is used to display the content of the referenced document.

B .20 math object
This object is not an attribute of another object, but a built-in object that contains many mathematical constants and functions.
attribute
E Euler Constant, bottom of the natural logarithm (approximately 2.718)
natural logarithm of ln2 2 (approximately 0.693)
natural logarithm of ln10 (approximately 2.302)
the logarithm of e with the base 2 of log2e (approximately 1.442)
the base-10 logarithm of E in log10e (approximately equal to o.434)
PI limit value (approximately equal to 3.14159)
the square root of sqrt1_2 0.5 (that is, dividing L by the square root of 2, which is approximately equal to o.707)
the square root of sqrt2 (approximately 1.414)
method
ABS () returns the absolute value of a number (that is, the distance between the number and O. For example, the absolute values of 2 and 1 are both 2).
ACOs () returns the arc cosine of a number (in radians)
asin () returns the arc sine of a number (in radians)
atan () returns the arc tangent of a certain number (in radians)
Ceil () returns the smallest integer equal to or greater than a certain number (Ceil (-22.22) return-22; ceil22, 22) return 23; Ceil (22) return 22)
CoS () return a certain number (in radians) returns the cosine of
exp ()
the opposite of floor () to Ceil (floor (22.22) returns a 23; floor (22.22) returns 22; floor (22) returns 22)
10g () returns the natural logarithm of a number (base on E)
MAX () returns a smaller value of two numbers
min ()
POW () returns the nth power of M (where M is the base, N is exponential.
random () returns a pseudo-random number between 0 and 1 (this method is only valid in Netscape
navigator's Unix Version)
round () returns an integer after rounding a number
sin () returns the sine of a number (in radians)
SQRT () returns the square root of a number.
Tan () returns the tangent of a number.

B .2l navigator object
This object is not a property of another object, but a built-in object that contains information about the browser that loads the document.
Attribute
Appcodename BrowserCodeName (for example, Mozilla)
Appname browser name
Version number of the appversion Browser
Useragent user and proxy header text sent from client to server
Method
This method is not currently available in javaenabled JavaScript, but will be added soon. It will check whether the browser is compatible with JavaScript. If yes, continue to check whether Javascript is supported.

B .22 options Array
This array is an attribute of the select object, that is, a list of all options (<option>) in the selection box.
Attribute
Default options in the defaselecselected Option List
Index position of an option in the index Option List
Number of options in the length Option List (<Options>)
Name of the name Option List (name feature)
Selected indicates whether an option <option> In the Option List is selected.
<Option> index (location) selected in the selectedindex Option List)
<Option> marked text in the text Option List
Value = feature in the value Option List

B .23 password object
It is an attribute of the Document Object and a <input type = "password"> flag.
Attribute
Default Value of the defaultvalue password object (value = feature)
Name Object Name (name = feature)
Value the current value of this field is initially the same as the value = feature (defauttvalue). However, if the script modifies the value of this field, the value will change
Method
Focus removes the focus from this domain
Blur moves focus to this domain
Select select input Region

B .24 radio object
It is an attribute of the form object, and a group of radio buttons (option buttons) (<input type = "radio">) in the form ).
Attribute
Status of the checked check box or Option Button (single choice button)
Default status of the ultchecked check box or Option Button (single choice button)
The number of buttons in the length group.
Name Object Name (name = feature)
Value value = feature
Method
Click simulate mouse click button
Event Handler
Onclick

B .25 Reset object
It is an attribute of the form object, reset button (<input type = "reset"> ).
Attribute
Name Object Name (name = feature)
Value value = feature
Method
Click simulate mouse click button
Event Handler
Onclick

B .26 select object
it is an attribute of the form object. Select box ( ). attribute Number of options in the length Option List () name of the name Option List (name feature) Number of options in the options list index (location) of the selected In the selectedlndex Option List Option) marked text value = feature in the value option list method blur shifts focus from the Option List focus moves focus to the Option List event handler onblur loses focus on current events onchange change onfocus event

B .27 String object
it is not a property of another object, but a built-in object, that is, a string must be enclosed in quotation marks in the input script.
attribute
Number of Characters in the length string
method
anchor () is used to convert the string to the HTML anchor tag ()
big () converts the text in the string to a large font ()
blink () converts the text in the string to a blinking font ( )
bold () converts the text in the string into a black font ( )
charat () searches for a character at a specified position in the string
fixed () change the text in the string to a fixed-padding font ()
fontcolor () to change the color of the text in the string ()
fontsize () convert the text in the string to a specified size ( )
indexof () is used to search for a special character in the string and return the index location of the character
italics () convert the text in the string into a diagonal font ( )
lastlndexof () similar to indexof, but search backward for the last character that appears
Link () used to convert a string to an HTML link tag (
)
small () converts the text in the string to a small font ()
Strike ()
sub () converts the text in the string to the subscript font (sub>)
substring () returns a part of the string at the specified position.
SUP () converts the text in the string to the superscript font ( )
tolowercase () converts the text in the string to lowercase.
touppercase () converts the text in the string to uppercase.

B .28 submit object
It is an attribute of the form object, and a submit button (<input type = "Submit">) in the form ).
Attribute
Name Object Name (name = feature)
Value value = feature
Method
Click simulate mouse click button
Event Handler
Onclick

B .29 Text object
It is an attribute of the form object and a text field (<input type = "text">) in the ry ).
Attribute
Default Value of the defaultvalue Text object (value = feature)
Name: name of the object (name = feature)
Value the current value of this field. It is initially the same as the value = feature (defaultvalue). However, if the script modifies the value of this field, the value will change.
Method
Blur removes focus from text box
Focus Move focus to text box
Select select input Region
Event Handler
Onblur loss focus event
Onchange changes
Onfocus event
Onselect select event

B .30 textarea object
It is an attribute of the form object and a text area (<textarea>) in the ry ).
Attribute
Default Value of the defaultvalue textarea object (value = feature)
Name: name of the object (name = feature)
Value: the current value of this field. It is initially the same as the value = feature (defaultvalue). However, if the script modifies the value of this field, the value is changed.
Method
Blur removes focus from the primary area
Focus: Move focus to focus area
Select select input region event handler
Event Handler
Onblur loss focus event
Onchange changes
Onfocus event
Onselect select event

B .31 window object
It is a top-level object, rather than the properties of another object, that is, the browser window.
Attribute
Defaultstatus default status message
The document currently displayed in the document (this attribute is also an object)
A frame (frame>) in the frame window (this attribute is also an object)
Frames array lists the array of Frame Objects in the window in the order they appear in the document (this attribute is also an object)
History List of the history window (this attribute is also an object)
Number of frames in the length window
Do not confuse the complete (absolute) URL of the document displayed in the location window (this attribute is itself an object) with the URL of the currently displayed document, such as document. location. You can change window. Location (Replace the current document with another document), but you cannot change document. Location (because this is the position of the currently displayed document)
When the name window is opened, the name of the window is assigned.
Opener indicates the window in which the script of the current window is opened using window. Open (this is a new attribute introduced by Netscape Navigator 3.0 Beta 3)
Parent contains the synonym of the current frame window. An attribute of the frame and window objects.
Synonym for self current window or frame
Messages in status bar
Top: Synonym that contains the top-level browser window of the current framework
The synonym for the current window or frame of window, which is the same as self.
Method
Alert () open an alert message box
Cleartimeout () is used to terminate the work of the setTimeout method.
Close () Close the window
Confirm () opens a confirm message box. You can select OK or cancel. If you click OK, this method returns true and cancel returns false.
Blur () removes focus from the specified window (this is a new method introduced by Netscape Navigator 3.0 Beta 3)
Focus () brings the specified window to the foreground (another new method)
Open () open a new window
Prompt () opens a prompt dialog box. You can type a text in the box and return the entered text to the script.
SetTimeout () waits for a specified period of time in milliseconds, and then runs the command event handler.
Event Handler
Triggered when the onload () page is loaded
Triggered when the onUnload () page is closed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.