JS objects and properties

xiaoxiao2021-03-05  24

Script tag

Used to include JavaScript code.

grammar

Attributes

Language defines a scripting language

SRC defines a URL to specify files ending with .js.

Windows object

The top-level object of each HTML document.

Attributes

Frames [] subride array. Each subrill array is stored in the order defined in the source document.

Feames.Length subris.

Self Current window.

The Parent parent window (the current window is a child window).

TOP top window (the parent window of all visible windows).

The message on the Status browser status window.

DEFAULTSTATUS When Status is invalid, the default message on the browser status window appears.

Name internal name, the name defined by the window opened by a Window.Open () method.

method

Alert ("Message" displays the "JavaScript Alert" dialog containing a given message.

Confirm ("Message") Displays the "CONFIRM" dialog containing a given message (with a OK button and a Cancel button). If the user comes to OK to return true, it returns false.

Prompt ("Message") Displays a "Prompt" dialog that requires the user to give appropriate input according to the display message.

Open ("URL", "Name") opens a new window and gives a specified name.

Close () Close the current window.

Frame object

It is a sub-window of the entire browser window. In addition to Status, defaultstatus, named, it has all properties of the Window object.

Location object

Contains information about the current URL.

Attributes

HREF's entire URL string.

Protocol contains a string of the first part of the URL, such as http:

Host contains a string of hostnames in the URL: port number part. Such as //www.cenpok.net/server/

Hostname contains a string of the hostname in the URL. Such as

http://www.cenpok.net

Port contains a port number string that may exist in the URL.

Part of the "/" in the Pathname URL. Such as ~ List / Index.htm

The string after the Hash "#" (CGI parameter).

Strings after Search "?" (CGI parameters).

Document object

Contains the object of the current document information.

Attributes

Title current document title, if not, "Untitled" is included.

The full URL of the Location document.

LastModified contains the document last modified date.

The REFERRER caller URL, that is, which URL is linked to the current page from the user.

Bgcolor background color (#xxxxxx)

FGColor foreground color.

LinkColor hyperlink color.

VLINKCOLOR visits the super chain colors.

AlinkColor activation chain color (mouse is not placed).

The array of Form objects in the Forms [] document is stored in the defined order.

The number of FORM objects in the Forms.Length document.

Links [] is in order to define storage in order to all HREF chains in the document.

The number of HREF chains in the links.length document.

Anchors [] Anchor (...) array, defined in order.

ANCHORS.LENGTH Document The number of anchors.

method

Write ("String") highlights the string to the current window. (String can contain HTML tags)

Writeln ("string") is similar to Write (), adding a carriage return at the end, only in the scheduled format (

...

or

...

) Take effect.

Clear () clear the current window.

Close () Close the current window.

FORM object

Attributes

Name

The string value of the Name property.

The class value of the Method attribute in Method, "0" = "get", "1" = "post" string value of the action attribute in the action.

Target table data submitted, the corresponding attributes in the tag are consistent.

Elements [index] Elements property contains individual elements in the Form.

The number of elements in the Length form.

method

Submit () submit form.

Event Processor OnSubmit () User Click a defined button to submit the code that is running when Form.

Text and Textarea objects

Attributes

The string value of the Name Name property.

VALUE domain content string value.

The initial string value of the DEFAULTVALUE domain content.

method

FOCUS () Sets the object input focus.

BLUR () removes the input focus on the object.

Select () Select the input area of ​​the object.

Event processor

ONFOCUS is executed when entering the focus.

ONBLUR is executed when the domain is lost.

Onsect is executed when some text in the domain is selected.

The ONCHANGE is executed when the domain is lost and the domain value is performed relative to the onfocus.

Check box (checkbox)

Attributes

The string value of the Name Name property.

Value check box content string value. If set, "ON", otherwise "OFF".

The Boolean value of the checked check box content. If set, TRUE is set, otherwise False.

DefaultChecked Reflects the Boolean value of the attribute (default).

method

Click () Select the check box and make the status as "on".

Event processor

OnClick is executed when a user clicks CheckBox.

Single selection button (RADIO) object

Attributes

The string value of the Name Name property.

The number of radio buttons in the LENGTH RADIO object.

Value Value property string value.

Checked Boolean value, press True, otherwise false.

DEFAULTCHECKED reflects the Boolean value of the checkage attribute value.

method

Click () Select the radio button.

Event processor

OnClick is executed when a radio button is selected.

SELECT object

Attributes

The number of objects in the LENGTH SELECT object.

Name The internal name of the SELECT object defined by the Name = property.

The subscript of the option Option in the SelectedIndex Select object is currently selected.

Options This property corresponds to the content in the tag when defining the Select object in HTML, which has the following properties:

Text string after Text tag.

The value of the value value attribute is submitted when the Submit button is pressed.

DefaultSelected reflects the Boolean value of the SELECTED property of the tag.

SELECTED reflects the Boolean value of the currently selected state of Option.

Event processor

ONFOCUS is executed when the input focus enters the domain.

ONBLUR is executed when the domain has lost the input focus.

Onchange is lost when the domain is lost, and if the domain is changed, the ONCHANGE is changed when the value of the ONFOCUS is executed.

Button object

There are three types of buttons in the table, defined by the TYPE attribute in the tag:

.submit (Type = "Submit")

.Reset (Type = "reset")

.custom (Type = "Button")

All button objects have the following ingredients:

Attributes

Value Value property string value.

The string value of the Name Name property.

method

Click () selected button

Event processor

OnClick is executed when the button is clicked.

Submit and reset object

Attributes

Value value = content of the property.

Name name = content of the property.

method

Click () selected button

Event processor

OnClick is executed when the button is clicked.

Password object

Attributes

DefaultValue value = content of the property .Name Name = content of the property.

Value is currently entering data from the Password domain.

method

FOCUS () Bring the focus into the Password domain.

Blur will move the focus from the Password domain.

Select () Select the current data in the Password domain for modification.

Navigator object

This object is used to determine the Navigator version used when users are accessible.

Attributes

AppCodename relative to the user's browser's "CODENAME"

Appname relative to the actual name of the user browser.

Appversion relative to the version number of the user browser.

UseERAGENT This property reflects all the information of the user browser.

String object

String object provides a lot of methods for the content of the operation string.

Attributes

The length of the LENGTH string, that is, the number of characters in the string.

method

BIG (), BLINK (), Bold (), Fixed (), Italics (), SMALL (), SUB (), Strike (), SUP (), FontColor (SIZE), FONTSIZE (SIZE)

The above method adds a corresponding HTML tag for a string.

Charat (index) Returns the characters at INDEX in the string.

Indexof (SearchValue, [fromNDEX]) This method looks for the first appearance of SearchValue in the string. If you give a given from PropertndEx,

The location of the string starts to search, and returns the position of the first character of the string when SearchValue is found.

LastIndexof (SearchValue, [fromNDEX]) searches for SearchValue before the end of the string, and reports the first instance found.

Substring (Indexa, IndexB) Gets substrings from INDEXA to IndexB.

TOLOWERCASE (), TouPpercase () Convert all characters in the string to uppercase, lowercase.

Date object

To use the Date object, you must be a Date instance:

Variable name = new Date ();

method

Getday (), getDate (), getHours (), getminutes (), getMonth (), getseconds (), getTime (),

Gettimezoneoffset (), getYear ()

There is a setday ... ...

Togmtstring () returns the current time with the GMT format. (Sun, 12 Feb 1999 14:19:22 GMT)

TOLOCALESTRING Returns the current time with Locale format. (03/11/99 14:19:22)

PARSE (Date) Converts a normal Date string into a font, thus gives SetTime ().

Math object

Attributes

LN10 (10 natural logarithm)

Pi (3.1415926 ...)

SQRT1_2 (1/2 square root)

method

ABS (x) returns the absolute value of X

ACOS (X) Returns the arc cosine value of X

Asin (x) Returns the Arc sin value of X

Atan (x) Returns the X's Arc Tangent value

CEIL (X) returns the minimum integer greater than equal to X

COS (x) Returns the Cosine value of X

Exp (x) Returns the X of E

Floor (x) returns the maximum integer that is less than equal to X

Log (x) returns x

Max (x, y) returns a large value in x, y

MIN (X, Y) Returns a small value in x, y

Pow (x, y) returns x Y

Round (x) rounds to the nearest integer, (less than or equal to 0.5 small number)

SIN (X) Returns the SIN value of X

SQRT (x) Returns the square root of X

Tan (x) Returns the Tangent value of X

转载请注明原文地址:https://www.9cbs.com/read-32068.html

New Post(0)