JS Object, Event

Source: Internet
Author: User

Label:

1. Common events:
Abort
Onabort (When object loading is interrupted)
Blur
Onblur (element loses focus)
Change
OnChange (selected element changes)
Click
OnClick (mouse click)
DblClick
OnDblClick (double left mouse button)
Error
OnError (Triggers on the Window object when the JS script is faulted, when <img> is triggered on the error, when the <Object> specified object cannot be loaded)
Focus
onfocus (Get Focus)
KeyDown
OnKeyDown (triggered when the keyboard key is pressed.) If you press a key all the time, it will not trigger. When False is returned, the default action is canceled)
KeyPress
onkeypress (Press a key to trigger when a word is generated, only one event is generated at a time)
KeyUp
OnKeyUp (triggered when a key on the keyboard is released)
Load
OnLoad (when the object is loaded)
MouseDown
OnMouseDown (triggered when any mouse button is clicked)
MouseMove
OnMouseMove (continues to trigger when the mouse moves over an element)
Mouseout
onMouseOut (triggers when the mouse is removed from the specified element)
MouseOver
onMouseOver (triggers when the mouse moves over an element)
MouseUp
OnMouseUp (triggers when any mouse button is released)
Reset
OnReset (click on the Reset button, <form> trigger)
Resize
OnResize (triggered when the size of a window or frame changes)
Scroll
Onscroll (when scrolling on any control with scroll bars)
Select
Onselect (when text is selected)
Submit
OnSubmit (triggered on <form> when the Submit button is clicked)
Unload
OnUnload (after the window object or frame is unloaded)
Onselectstart (When the text is selected, if the value is set to False, the Chinese version is not selected)




2. Common objects:
Global, String, Math, Date, Window, Document, location, Array, Function, number, history, event object.

Globals object (global function):
Eval (x)
Evaluates to return the value of the expression x
Isfinite (number)
Returns true for a finite number
IsNaN (number)
True for non-numeric returns
Parsefloat (String)
Convert to floating point value
parseint (String,radix)
Converts a string to an integer
Escape (String)
Converts a string into a new string, and some characters are converted to escape sequences according to RFC1738
Unescape (String)
Converts the Escape () encoded string to its Ascⅱ code
encodeURI (URI)
Converts a URI into an encoded URI using UTF-8 encoding
decodeURI (URI)
Recursive conversion of the encodeURI () function
encodeURIComponent (uricomponent)
Using UTF-8 encoding to turn uricomponent into an encoded URI
decodeURIComponent (uricomponent)
Recursive conversion of the encodeURIComponent () function



String object:
(1) Properties:
Length: Long
Prototype: Returns a reference to the object type prototype
Constructor: Functions to create objects


(2) Method:
Anchor (name)
Add <a name=name ></a> tag pairs
Big ()
Add <big></big> Tag Pairs
Bold ()
Add <b></b> Tag Pairs
CharAt (Index)
Returns a string of characters of the specified index number in a string object, with a valid value of 0 to the string length minus 1. The first index position of a string is 0, the second is 1, and so on. When the specified index position is outside the valid range, Charat returns an empty string.
charCodeAt (Index)
Returns an Integer that represents the character Unicode encoding at the specified position in the string object
Concat (S1,,,,, sn)
Combines a string that invokes a method with a specified string, resulting in a new string being returned
FontColor
Adds an HTML <font></font> tag pair to the content added to the string object, and sets the Color property, which can be either a 16-binary value of the colors or a predefined name for the color
FontSize (size)
Adds an HTML <font></font> tag pair to the contents of the string object and sets the Size property
IndexOf (pattern)
Returns the position value in the string that contains the first occurrence of the parameter that the pattern represents. Returns 1 if not included
IndexOf (Pattern,startindex)
Same as above, just starting from the startindex specified position to find
LastIndexOf (Pattern)
The return string contains the position value of the last occurrence of the parameter that the pattern represents. Returns 1 if not included
LastIndexOf (Pattern,startindex)
Same as above, only starting from startindex specified position
Localecompare (s)
Compares a string with an S string in a specific way. Returns 0 if the string is equal, otherwise a numeric value other than 0 is returned
Link
Adds a hyperlink tag pair to the contents of a string object, that is, to display the string as hyperlinks
Match (REGEXP)
Performs a search on a string using the regular expression pattern and returns an array containing the search results.
Replace (Searchvalue,repalcevalue)
Change Searchvalue to Repalcevalue and return results
Search (REGEXP, [int begin])
Returns the position of the first matched substring in the entire searched string when using a regular expression search, where the position is counted from 0, that is, the position of the first character is 0
Slice (start,end)
Returns a substring from start to end of the previous character (returns a substring from start to end when no end is defined)
Split (Separator,limit)
Divides a string into substrings with a separator delimiter and stores it in an array, if limit is specified, the array is limited to the number specified by the limit, the separator delimiter can be multiple characters or a regular expression, and it is not returned as part of any array element
SUBSTR (Start,length)
Returns a substring of length characters starting from startindex in a string
SUBSTIRNG (From,to)
Returns a substring that ends with a from start
Sub ()
Adds an HTML <sub></sub> tag pair to the contents of a String object
SUP ()
Adds a HTNL <sup></sup> tag pair to the contents of a String object
toLowerCase ()
Returns a string that all letters in the string are converted to lowercase letters
toLocaleLowerCase ()
Returns the string that becomes lowercase
ToString ()
Returns the string value of an object
toUpperCase ()
Returns a string that all letters in the string are converted to uppercase
toLocaleUpperCase ()
Returns the string that becomes uppercase
ValueOf ()
Returns the string value of an object





Math Object
(1) Method:
ABS (x)
Returns the absolute value of X
ACOs (x)
Returns the inverse cosine of x radians
ASIN (x)
Returns the inverse of the X-arc chord
Atan (x)
Returns the arc tangent of x radians
atan2 (x, y)
Returns the polar coordinate angle of the coordinate (x, y) corresponding
Ceil (x)
Returns the smallest integer greater than or equal to X
COS (x)
Returns the cosine of X
EXP (x)
Returns the X-exponent of E
Floor (x)
Returns the largest integer less than or equal to X
Log (x)
Returns the natural logarithm of X
Max (x, y)
Returns the maximum number in X and Y
Min (x, y)
Returns the minimum number in X and Y
Pow (x, y)
Returns the X-to-y second-party
Random ()
Returns the number of random numbers between 0 and 1
Round (x)
Returns the integer closest to X, which is the rounding function
Sin (x)
Returns the sinusoidal value of x
sqrt (x)
Returns the square root of X
Tan (x)
Returns the tangent value of X


(2) Properties:
E
Euler Constants (2.718281828459045)
LN2
Natural logarithm of 2 (0.6931471805599453)
LN10
Natural logarithm of 10 (2.3025850994046)
Log2e
Logarithm of base E of 2 (1.4426950408889633)
log10e
Logarithm of base e of 10 (0.4342944819032518)
Pi
PI constant (3.141592653589793)
Sqrt1-2
Square root of 0.5 (0.7071067811865476)
SQRT2
Square root of 2 (1.14142135623730951)





Date object:
(1) method
Get[utc]fullyear ()
Returns the year in a Date object, expressed as a 4-digit number, using local time or the
Get[utc]year ()
Returns the year in a Date object, typically without using the method, and using getFullYear ()
Get[utc]month ()
Returns the month (0-11) in the Date object, using local time or the
Get[utc]date ()
Returns the number of days (1-31) in a Date object, using local time or the
Get[utc]day
Returns the day of the Week (0-6) in the Date object, using local time or the
Get[utc]hours ()
Returns the number of hours in a Date object (0-23), using local time or the
Get[utc]minutes ()
Returns the number of minutes (0-59) in a Date object, using local time or the
Get[utc]seconds ()
Returns the number of seconds (0-59) in a Date object, using local time or the
Get[utc]milliseconds ()
Returns the number of milliseconds in a Date object, using local time or the
getTimezoneOffset ()
Returns the difference between the local time of the date and the UTC representation, in minutes
GetTime ()
Returns the internal millisecond representation of a Date object. Note that this value is independent of the time zone, so there is no separate getutctime () method
Set[utc]fullyear ()
Sets the year in the Date object, in 4-digit numbers, using local time or the
Set[utc]year ()
Sets the year in the Date object, using the local time or the
Set[utc]month ()
Sets the month in the Date object, using the local time or the
Set[utc]date ()
Sets the day in the Date object, using the local time or the
Set[utc]hours ()
Sets the hour in the Date object, using local time or the
Set[utc]minutes ()
Sets the minutes in the Date object, using local time or the
Set[utc]seconds ()
Sets the number of seconds in a Date object, using local time or the
Set[utc]milliseconds ()
Sets the number of milliseconds in a Date object, using local time or the
SetTime ()
Set the fields of a Date object using milliseconds
TODATESTIRNG ()
Returns a string representation of the date part of a date, using local time
toUTCString ()
Converts a Date object into a string, using the Universal
toLocaleDateString ()
Returns a String representing the date part of the date, using the local date
toLocaleTimeString ()
String that returns the time part of the date, using local time
ToString ()
Converts a Date object into a string, using local time
toTimeString ()
Returns a string representation of the time portion of a date, using local time
ValueOf ()
Converts the date object to its internal millisecond representation





Window object:
(1) Properties:
Document
Read-only references to document objects that contain documents in a window or frame
Document.body.offsetHeight; Returns the current page height
Defaultstatus
A writable character that specifies the default message for the status bar
Frames
Represents a collection of all the frame objects in the current object
Location
The location object that is used to represent the window or frame. If you assign a URL to this property, the browser will load and display the document specified by the URL
Length
The number of frames that the window or frame contains
History
Read-only reference to the history object of a window or frame
Name
The name used to store the window
Status
A writable character that specifies the current information in the status bar
Top
A browser window that represents the topmost level
Parent
Represents the parent window that contains the current window
Opener
Indicates that the parent window of the current window is open
Closed
A read-only Boolean value that indicates whether the current window is closed. When the browser window is closed, however, the Window object that represents it does not disappear, but its closed property is set to True
Self
Represents the current window
Screen
A read-only reference to a window or frame's screen object, providing a message such as display size, color depth, and so on
Screen.availwidth returns the current screen width (white space)//avail Height
Screen.width returns the current screen width (resolution value)//Height
Navigator
A read-only reference to a window or frame's navigator object that can be used to obtain browser-related information through the Navigator object
Method
Alert ()
Pop up a warning dialog box
Confirm ()
Displays a confirmation dialog box that returns True when the Confirm button is clicked, otherwise false
Prompt ()
A prompt dialog box pops up and asks for a simple string to enter
Blur ()
Remove the keyboard focus from the top-level browser window. On most platforms, this will use the window to move to the last face
Close ()
Close window
Focus ()
Remove the keyboard focus from the top-level browser window. On most platforms, this will use the window to move to the front
Open ()
Open a new window
ScrollTo (x, y)
Scrolls the window to the specified location at the specified x, y coordinates
Scrollby (offsetx,offsety)
Scrolls the window by the specified amount of displacement
SetTimeout (timer)
Execute code after a specified time
Cleartimeout ()
Cancels deferred execution of the specified code
MoveTo (x, y)
Move the exposure to an absolute position
Moveby (offsetx,offsety)
Moves the window to the specified displacement amount
Resizeto (x, y)
Set the size of the window
Resizeby (offsetx,offsety)
Sets the size of the window according to the specified amount of displacement
Print ()
Equivalent to the Print button in the browser toolbar
SetInterval ()
Cycle execution of the specified code
Clearinterval ()
Stop periodic execution of code
Navigate ()
ie method for loading and displaying the specified URL
Back ()
Netscape method, equivalent to clicking the "Back" button in the Netscape browser
Forward ()
Netscape method, equivalent to clicking the "Forward" button in the Netscape browser
Home ()
Netscape method, which is used to display the browser's home page
Stop ()
Netscape method, equivalent to clicking the "Stop" button in the Netscape browser
Parameter description of the open () method
Windowvar=window.open (Url,windowname[,location])
Windowvar
The handle of the currently open window. If the open () method executes successfully, the value of Windowvar is a handle to a Window object. Otherwise the value of Windowvar is a null value
Url
The URL of the destination window. If the URL is an empty string, the browser opens a blank window that allows you to create dynamic HTML with write ()
Windowname
Used to specify the name of the new window, which can be used as the value of the <a> tag and the target property of <form>. If the parameter specifies a window that already exists, the open () method will no longer create a new window, but simply return a reference to the specified window
Location
To set the window properties, the optional parameters are shown in the following table



(2) Optional Parameters for window property settings
Width
Width of window
Height
Height of window
ScrollBars
Whether scroll bars are displayed
Resizable
Sets whether window size is fixed
Toolbar
browser toolbar, including back and forward buttons, etc.
MenuBar
menu bar, which generally includes files, edits, and other food items
Location
The locator area, also called the Address bar, is the browser text area where you can enter a URL
Direction
buttons to update information
Fullscreen
Full Screen display





Document object:
(1) Properties:
All (ElementID)
Represents a collection of all <html> tags in a document (only applicable with IE)
Alinkcolor
Set the color of a link that is activated
Anchors
Get a collection of <anchor> tags in a document (array)
Bfcolor
Set Background color
Fgcolor
Set the document's foreground color (text)
Cookies
Get the cookie associated with the document
Domain
The security domain used to specify the document
Embeds
Represents an array of all <embed> tags in a document
Forms
Represents an array of all <form> tags in a document
GetSelection ()
Returns the selected text
Images
Represents an array of all <image> tags in a document
LastModified
Represents the last modified time for a document
LinkColor
Set the color of a link that has not been visited
Links
Represents an array of all <a> tags in a document
Title
Get the title of the document
Url
Returns the URL for the document
Vinkcolor
Set to access the color of a link
Method
Open ([MimeType])
Prepares a stream for the write () and writeln () statements whose parameters mimetype can be several MIME types (including Text/html,text/plain,image/x-bitmap and Plugln (any Netscape Plug-in MIMEtype)), the default value is text/html
Close ()
Close the stream opened by the open () method
Focus ()
Get focus for the specified document
Write ()
Writing text to a document worker
Writeln ()
Writes text to a document employee and appends a newline character to the end of the document





Location object:
(1) Properties:
Hash
Represents the anchor part of the current URL, including the leading hash character "#" (such as #top). This part of the document URL (#top) specifies the name of the anchor in the document
Host
Represents the host and port number sections in the current URL
Hostname
Indicates host name and domain name
Pathname
Represents the current URL path name
Href
Represents the full name of the URL
Port
The communication port number that represents the current URL
Protocol
Represents the protocol part of the current URL, such as Http,ftp
Search
Represents the query string part of the current URL, which is the parameter that is passed to the server later


(2) Method:
Reload ()
Refresh the current page
Replace ()
Replaces the current page with a page specified by a URL





Array object:
(1) Properties:
Constructor
Constructors that reference array objects
Length
Returns the number of elements in an array
Prototype
Used to add new properties and methods when defining an array, prototype is the static property of the Array object

(2) method
Concat ()
Returns a new array, which is a combination of two or more arrays
Join ()
Converts all elements in an array to a string, and then joins each element separated by the specified delimiter
Pop ()
Delete the last element in an array
Push (value,....)
Add an element to the tail of an array
Reverse ()
Reverses the order of elements in an array on the original array
Shift ()
Delete the first element in an array
Slice (start,end)
Extracts a specified number of data elements from an existing array, forming a new array. The index of the extracted element starts at start and ends at end, but does not include the end
Sort ()
Sort the array elements

Inserting and deleting elements from an array
toLocaleString
Returns the localized string representation of an array
ToString ()
Returns the string representation of an array
Unshift (Value,.....)
Inserts an array element in the head of an array
Splice () method description
Array.splice (Start,deletecount,value,....)
Start: Specifies the subscript at which to start inserting or deleting an array element
DeleteCount: Used to specify the number of elements to be deleted, including the element that start refers to
Value,....: Used to specify 0 or more values to insert into the array, starting at the subscript specified by start




Function object
(1) Properties:
Arguments[]
A parameter array, the arguments passed to the function when the array element
Caller
A reference to a function object that invokes the current function, if the current function is called by the top-level code, this property value is null
Constructor
Returns the function that created the object
Length
Represents the number of named arguments that are specified when a function is declared
Prototype
Returns a reference to the object type prototype


(2) Method:
Apply (Thisobj,args)
Call the function as a method of the specified object. Thisobj is the object that invokes function, in the body of the function, the value of the Thisobjshirt keyword this; args is an array whose elements are the parameter values to pass to the function
Call (Thisobj,arg1 ...)
Call the function as a method of the specified object. Thisobj is the value of the Thisobjshirt keyword this in the function body of the object that invokes function; ARGS1 ... Any number of arguments passed to the function
ToString ()
Returns a string representation of a function




Number Object
(1) Properties:
Max_value
Returns the maximum number of JavaScript that can be represented, approximately equal to 1.79E+308
Min_value
Returns the nearest 0 of the number that JavaScript can represent, approximately equal to 2.22E-308
NaN
A special value that represents an arithmetic expression that returns a non-numeric value
Positive_infinity
Returns the maximum number, in JavaScript, that can be represented. Max_value) Greater value
Negative_infinity
Returns the smallest number that can be represented in JavaScript. Min_value) Smaller values
Prototype
Returns a reference to the object type prototype

(2) Method:
toLocaleString ()
Returns the string value version of the current number according to the browser settings in a certain format
ToString ()
Returns a string specified by the number object
ValueOf ()
Returns the original value of the specified object
Toexponential ()
Force characters to be represented by exponential notation
ToFixed ()
Show currency calculation results with units and percentile units such as US dollars and cents
Toprecision ()
Defines how many digits (including decimal points) The value displays in total, that is, the precision of the value can be defined




History Object
(1) Properties:
Length
The length of the history list. Used to determine the number of entries in the list
Current
The URL of the current document
Next
The next URL of the history list
Previous
Previous URL for History list


(2) Method:
Back ()
Return to previous URL
Forward ()
Access the next URL
Go ()
Transfer to a URL that has been previously visited

JS Object, Event

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.

Tags Index: