Javascript objects and Arrays

Source: Internet
Author: User
Tags close close mathematical constants gopher natural logarithm time in milliseconds
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/suppor...script/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, a form in the document.

Attribute

Action contains the string of the target URL submitted for a form

A button in the button form, which is created using the <input type = "button"> MARK (this attribute is also an object)

Checkbox check box, which is created with the <input type = "checkbox"> MARK (this attribute is also an object)

Elements array is an array that lists elements of a form in the order it appears in the Form (this attribute is also an object)

Mime encoding of the encoding form

A hidden element in the hidden form (<input type = "hidden"> ). An attribute of a form object (this attribute is also an object)

Number of elements in the length form

The method used to transmit data from the Method Input form to the server, that is, the method feature in the form mark.

Radio button (<input type = "radio">) 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 (<SELECT>) (This attribute is also an object)

The submit button in the submit form (<input type = "Submit">) (This attribute is also an object)

After the target submits the form, the name of the response window is displayed.

Text elements in the text form (<input type = "text">) (This attribute is also an object)

<Textarea> (this attribute is also an object)

Method

Submit 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

Onerror

Onabort

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

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 other objects, but a built-in object that contains many mathematical constants and functions.

Attribute

E Euler Constant, bottom of the natural logarithm (approximately 2.718)

The natural logarithm of ln2 2 (approximately 0.693)

Natural logarithm of ln10 10 (approximately 2.302)

The logarithm of e whose log2e base is 2 (approximately 1.442)

The base-10 logarithm of E in log10e (approximately equal to o.434)

Pi limit value (approximately 3.14159)

The square root of sqrt1_2 0.5 (that is, dividing L by the square root of 2, 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 value equal to a number, or the smallest integer greater than this number (Ceil (-22.22) returns-22; ceil22, 22) returns 23; Ceil (22) returns 22)

Cos () returns the cosine of a certain number (in radians ).

Exp () returns en

Floor () is opposite to Ceil (floor (A 22.22) returns a 23; floor (22.22) returns 22; floor (22) returns 22)

10g () returns the natural logarithm of a certain number (base on E)

Max () returns a greater limit between two numbers.

Min () returns a small value of two numbers.

Pow () returns the N power of M (where M is the base and N is the index)

Random () returns a pseudo-random number between 0 and 1 (this method is only available in Netscape

Valid in the Unix Version of Navigator)

Round () returns an integer after rounding.

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

Remove (I) delete item I

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 (<SELECT> ).

Attribute

Number of options in the length Option List (<Options>)

Name of the name Option List (name feature)

Number of options in the options list

<Option> index (location) selected in the selectedlndex Option List)

Text marked by the option in the text Option List

Value = feature in the value Option List

Method

Blur shifts focus from the Option List

Focus Move focus to Option List

Event Handler

Onblur

Onchange

Onfocus

B .27 String object

It is not a property of another object, but a built-in object, that is, a string of character strings must be enclosed in quotation marks in the input script.

Attribute

Number of Characters in the length string

Method

Anchor () is used to convert a string to an HTML anchor tag (<a name =>)

Big () converts the text in the string to a large font (<big>)

Blink () converts text in a string into a blinking font (<blink>)

Bold () converts the text in the string to a black font (<B>)

Charat () searches for a character at the specified position in the string

Fixed () converts the text in the string to a fixed-padding font (<tt>)

Fontcolor () changes the color of text in a string (<font color =>)

Fontsize () converts the text in the string to the specified size (<fontsize =>)

Indexof () is used to search for a special character in a string and return the index position of the character.

Italics () converts the text in a string into a diagonal font (<I>)

Lastlndexof () is similar to indexof, but searches backward for the last character that appears.

Link () is used to convert a string to an HTML link tag (<a href =>)

Small () converts the text in the string into a small font (<small>)

Strike () converts the text in the string into a font (<strike>)

Sub () converts the text in a string into a subscript font (sub>)

Substring () returns a part of the string at the specified position.

Sup () converts the text in the string into a superscript font (<sup>)

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

Onchange

Onfeus

Onselect

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

Onblur

Onchange

Onfocus

Onselect

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.

Onload

onUnload

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.