JavaScript Reference Manual

JavaScript Reference Manual

Alphabetically listed JavaScript reference manual

Attribute/Method Describes Belongs to
abs() Return the absolute value of x. Math
accessKey Set or return the accesskey attribute of the element. Element
acos() Return the inverse cosine of x, in radians. Math
acosh() Return the hyperbolic inverse cosine of x. Math
activeElement Return the element that currently has focus in the document. Document
addEventListener() Attach an event handler to the document.
adoptNode() Adopt a node from another document. Document
alert() Display an alert box with a message and a 'OK' button. Window
altKey Return whether the 'ALT' key is pressed when the mouse event is triggered.
anchors Return the collection of all <a> elements with the name attribute in the document. Document
animationName Return the name of the animation. AnimationEvent
appCodeName Return the code name of the browser. Navigator
appendChild() Add a new child node to the element, as the last child node. Element
applets Return the collection of all <applet> elements in the document. Document
appName Return the name of the browser. Navigator
appVersion Return the version information of the browser. Navigator
asin() Return the inverse sine of x, in radians. Math
asinh() Return the hyperbolic inverse sine of x. Math
assert() If assertion is false, write the error message to the console. Console
assign() Load a new document. Location
atan() Return the arctangent value of x as the number between -PI/2 and PI/2 radians. Math
atan2() Return the arctangent of the quotient of its parameters. Math
atanh() Return the hyperbolic arctangent of x. Math
atob() Decode a base-64 encoded string. Window
attributes Return the NamedNodeMap of the element's attributes. Element
availHeight Return the height of the screen (excluding the Windows taskbar). Screen
availWidth Return the width of the screen (excluding the Windows taskbar). Screen
back() Load the previous URL in the history list. History
baseURI Return the absolute base URI of the document. Document
blur() Remove focus from the element.
body Set or return the body (body element) of the document. Document
break Exit the switch or loop. Statements
btoa() Encode a string in base-64. Window
bubbles Return whether a specific event is a bubbling event. Event
button Returns the mouse button pressed when the mouse event is triggered. MouseEvent
buttons Returns the mouse button pressed when the mouse event is triggered. MouseEvent
cancelBubble Set or return whether the event should propagate up the hierarchy.
cancelable Return whether the event can prevent its default action. Event
cbrt() Return the cube root of x. Math
ceil() Return x, rounded up to the nearest integer. Math
changeTouches Return a list of all touch objects whose state has changed between the previous touch and the current touch TouchEvent
characterSet Return the character encoding of the document. Document
charAt() Return the character at the specified index (position). String
charCode Return the Unicode character code of the key that triggered the onkeypress event. KeyboardEvent
charCodeAt() Return the Unicode of the character at the specified index. String
charset Not recommended for use.Please use characterSetReturn the character encoding of the document. Document
childElementCount Return the number of child elements owned by the element. Element
childNodes Return the collection of child nodes (including text and comment nodes) of the element. Element
children Return the collection of child elements of the element (excluding text and comment nodes). Element
classList Return the class name of the element. Element
class Declare a class. Statements
className Set or return the value of the element's class attribute. Element
clear() Clear the console.
clearInterval() Clear the timer set using setInterval(). Window
clearTimeout() Clear the timer set using setTimeout(). Window
clearWatch() Unsubscribe the location/error monitor handler previously installed using Geolocation.watchPosition(). Geolocation
click() Simulate a mouse click on the element. Element
clientHeight Returns the height of the element, including padding. Element
clientLeft Returns the width of the left border of the element. Element
clientTop Returns the width of the left border of the element. Element
clientWidth Returns the width of the element, including padding. Element
clientX Returns the horizontal coordinate of the mouse pointer relative to the current window when the mouse event is triggered.
clientY Returns the vertical coordinate of the mouse pointer relative to the current window when the mouse event is triggered.
clipboardData Returns an object that contains data affected by clipboard operations. ClipboardData
closed Returns a boolean value indicating whether the window has been closed. Window
close() Closes the output stream opened previously using document.open().
closest() Search up the DOM tree to find the nearest element that matches the specified CSS selector. Element
clz32(x) Returns the number of leading zeros in the 32-bit binary representation of x. Math
code Returns the code of the key that triggered the event. KeyboardEvent
colorDepth Returns the color depth of the palette used to display the image. Screen
compareDocumentPosition() Compare the document positions of two elements. Element
compile() Deprecated in version 1.5.Compile a regular expression. RegExp
composed Indicates whether the event can be passed from the Shadow DOM to the general DOM. Event
composedPath() Returns the path of the event. Event
concat() Join two or more arrays and return a copy of the concatenated array.
confirm() Display a dialog box that shows a message and 'OK' and 'Cancel' buttons. Window
const Declare a variable with a constant value. Statements
constructor() Create and initialize an object created in a class. Classes
constructor Returns the function that creates the prototype of the Array object.
contains() Returns true if the node is a descendant of a certain node, otherwise returns false. Element
contentEditable Set or return whether the content of the element is editable. Element
continue If the specified condition occurs, the loop is interrupted once (within the loop), and the next iteration within the loop is continued. Statements
console Returns a reference to the Console object, which provides methods for logging information to the browser console (see Console object). Window
cookie Returns all cookie name/value pairs in the document. Document
cookieEnabled Determine whether cookies are enabled in the browser. Navigator
coordinates Returns the location and altitude of the device on Earth. Geolocation
copyWithin() Copy array elements from and to specified positions within the array. Array
cos(x) Returns the cosine of x, in radians. Math
cosh(x) Returns the hyperbolic cosine of x. Math
count() Record the number of times this specific call to count() has been invoked. Console
createAttribute() Create an attribute node. Document
createComment() Create a Comment node with the specified text. Document
createDocumentFragment() Create an empty DocumentFragment node. Document
createElement() Create an Element node. Document
createEvent() Create a new event.
createTextNode() Create a Text node. Document
ctrlKey Returns whether the "CTRL" key was pressed when the mouse event was triggered.
currentTarget Returns the element that triggered the event with its event listener. Event
data Returns the inserted character. InputEvent
dataTransfer Returns an object that contains the data being dragged or inserted/deleted.
debugger Stop executing JavaScript and call the debugging feature (if any). Statements
decodeURI() Decode URI. Global
decodeURIComponent() Decode URI components. Global
defaultPrevented Returns whether the preventDefault() method was called for the event. Event
defaultStatus Set or return the default text in the window status bar. Window
defaultView Returns the window object associated with the document; returns null if there is no available window object. Document
delete Remove the property from the object Operators
deltaX Returns the horizontal scroll amount (x-axis) of the mouse wheel. WheelEvent
deltaY Returns the vertical scroll amount (y-axis) of the mouse wheel. WheelEvent
deltaZ Returns the Z-axis scroll amount of the mouse wheel. WheelEvent
deltaMode Returns a number representing the measurement unit of the increment value (pixels, lines, or pages). WheelEvent
designMode Control whether the entire document should be editable. Document
detail Returns a number indicating how many times the mouse has been clicked. UiEvent
dir Set or return the value of the element's dir attribute. Element
do ... while Execute a statement block and repeat the statement block if the condition is true. Statements
doctype Returns the document type declaration associated with the document. Document
document Returns the Document object of the window (see Document object) Window
documentElement Returns the Document element (the <html> element) of the document. Document
documentMode Returns the mode in which the browser renders the document. Document
documentURI Set or return the location of the document. Document
domain Returns the domain name of the server that loaded the document. Document
domConfig Outdated.Returns the DOM configuration of the document. Document
elapsedTime Returns the number of seconds the animation has run. AnimationEvent
elapsedTime Returns the number of seconds the transition has run.  
embeds Returns the collection of all <embed> elements in the document. Document
encodeURI() Encode URI. Global
encodeURIComponent() Encode URI components. Global
E Returns Euler's number (approximately 2.718). Math
endsWith() Check if the string ends with the specified string/character. String
entries() Returns the Array Iteration Object key-value pair. Array
error() Output the error message to the console. Console
escape() 1.5版中已弃用。改用encodeURI()encodeURIComponent() Global
eval() Evaluate the string and execute it as if it were script code. Global
eventPhase Returns which phase the current event stream is at. Event
every() Check if each element in the array passes the test. Array
exec() Test the match items in the string. Returns the first match item. RegExp
execCommand() Invoke the specified clipboard operation on the element currently having the focus. Document
exitFullscreen() Exit the element in full-screen mode. Element
exp(x) Returns the value of Ex. Math
expm1(x) Returns Ex The value minus 1. Math
export Export the function so that it can be used in importing external modules and other scripts.
extends Extend class (inheritance). Classes
fill() Fills the elements in the array with static values. Array
filter() Creates a new array using each element that passes the test in the array. Array
find() Returns the value of the first element that passes the test in the array. Array
findIndex() Returns the index of the first element that passes the test in the array. Array
floor() Returns x, rounded down to the nearest integer. Math
focus() Focuses the element.
for Marks a statement block to be executed as long as the condition is true. Statements
for ... in Marks a statement block to be executed for each element of an object (or array). Statements
forEach() Calls a function for each array element. Array
forms Returns a collection of all <form> elements in the document. Document
forward() Loads the next URL in the history list. History
frameElement Returns the <iframe> element that inserted the current window. Window
frames Returns all <iframe> elements in the current window. Window
from() Creates an array from an object. Array
fromCharCode() Converts a Unicode value to a character. String
fround() Returns the nearest (32-bit single-precision) floating-point representation of a number. Math
fullscreenElement Returns the current element displayed in full-screen mode. Document
fullscreenEnabled() Returns a boolean value indicating whether the document can be viewed in full-screen mode. Document
function Declares a function. Statements
geolocation Returns the Geolocation object, used to locate the user's position. Navigator
getDate() Returns the day of the month (1-31). Date
getDay() Returns the day of the week (0-6). Date
getAttribute() Returns the specified attribute value of the element node. Element
getAttributeNode() Returns the specified attribute node. Element
getBoundingClientRect() Returns the size of the element and its position relative to the viewport. Element
getComputedStyle() Gets the current computed CSS style applied to the element. Window
getCurrentPosition() Returns the current position of the device. Geolocation
getElementById() Returns the element that has an ID attribute with the specified value. Document
getElementsByClassName() Returns a NodeList containing all elements that have the specified class name.
getElementsByName() Returns a NodeList containing all elements that have the specified name. Document
getElementsByTagName() Returns a NodeList containing all elements that have the specified tag name.
getFullYear() Returns the year. Date
getHours() Returns the hour (0-23). Date
getItem() Returns the value of the specified key name. Storage
getMilliseconds() Returns the milliseconds (0-999). Date
getMinutes() Returns the minutes (0-59). Date
getModifierState() Returns an array containing the target range, which will be affected by insertion/deletion. MouseEvent
getMonth() Returns the month (0-11). Date
getNamedItem() Returns the specified attribute node from the NamedNodeMap. Attribute
getSeconds() Returns the seconds (0-59). Date
getSelection() Returns a Selection object representing the text range selected by the user. Window
getTargetRanges() Returns an array containing the target range, which will be affected by insertion/deletion. InputEvent
getTime() Returns the number of milliseconds since midnight on January 1, 1970, for the specified date. Date
getTimezoneOffset() Returns the time difference between UTC time and local time, in minutes. Date
getUTCDate() Returns the day of the month (1-31) based on world standard time. Date
getUTCDay() Returns the day of the week (0-6) based on world standard time. Date
getUTCFullYear() Returns the year based on world standard time. Date
getUTCHours() Returns the hour (0-23) based on world standard time. Date
getUTCMilliseconds() Returns the milliseconds (0-999) based on world standard time. Date
getUTCMinutes() Returns the minutes (0-59) based on world standard time. Date
getUTCMonth() Returns the month (0-11) based on world standard time. Date
getUTCSeconds() Returns the seconds (0-59) based on world standard time. Date
getYear() It is not recommended to usePlease use getFullYear() Method instead. Date
global Check if the 'g' modifier has been set. RegExp
go() Load a specific URL from the history list. History
group() Create a new group in the console. This will provide an additional level of indentation for console messages until console.groupEnd() is called. Console
groupCollapsed() Create a new group in the console. But this new group is collapsed. The user needs to use the button to expand it. Console
groupEnd() Exit the current group in the console. Console
hasAttribute() If an element has the specified attribute, it returns true; otherwise, it returns false. Element
hasAttributes() If an element has any attribute, it returns true; otherwise, it returns false. Element
hasChildNodes() Return true if the element has any child nodes, otherwise return false. Element
hasFocus() Return a boolean value indicating whether the document has focus. Document
hash Set or return the anchor (#) of the URL. Location
head Return the <head> element of the document. Document
height Return the total height of the screen. Screen
history Return the window's History object (see History Object). Window
host Set or return the hostname and port number of the URL. Location
hostname Set or return the hostname of the URL. Location
href Set or return the entire URL. Location
id Set or return the value of the element's id attribute. Element
if ... else ... else if Mark a block of statements that are executed based on a condition. Statements
ignoreCase Check if the "i" modifier has been set. RegExp
images Return a collection of all <img> elements in the document. Document
implementation Return the DOMImplementation object that handles this document. Document
import Import functions exported from external modules and another script.
importNode() Import a node from another document. Document
in Return true if the specified property exists in the specified object, otherwise return false. Operators
includes() Check if the array contains the specified element.
indexOf() Search for an element in an array and return its position.
Infinity Represents the numerical value of positive/negative infinity. Global
info() Output informational messages to the console. Console
innerHeight Return the height of the window content area (viewport) that includes scrollbars. Window
innerHTML Set or return the content of the element. Element
innerText Set or return the text content of the node and its descendants. Element
innerWidth Return the width of the window content area (viewport) that includes scrollbars. Window
inputEncoding Return the encoding and character set used for the document. Document
inputType Return the type of change (i.e., "inserting" or "deleting"). InputEvent
insertAdjacentElement() Insert HTML elements at the specified position relative to the current element. Element
insertAdjacentHTML() Insert HTML-formatted text at the specified position relative to the current element. Element
insertAdjacentText() Insert text into the specified position relative to the current element. Element
insertBefore() Insert a new child node before the specified existing child node. Element
instanceof Return true if the specified object is an instance of the specified object. Operators
isArray() Check if the object is an array. Array
isComposing Return whether the state of the event is being composed.
isContentEditable Return true if the content of the element is editable, otherwise return false. Element
isDefaultNamespace() Return true if the specified namespaceURI is the default value, otherwise return false. Element
isEqualNode() Check if two elements are equal. Element
isFinite() Determine if the value is a finite valid number.
isId Return true if the attribute is of ID type, otherwise return false. Attribute
isInteger() Check if the value is an integer. Number
isNaN() Determine if the value is an invalid number.
isSafeInteger() Check if the value is a safe integer. Number
isSameNode() Check if two elements are on the same node. Element
isSupported() Return true if the element supports the specified feature, otherwise return false. Element
isTrusted Return whether the event is trusted. Event
item() Return the attribute node at the specified index in the NamedNodeMap.
join() Join all elements of the array into a string. Array
key Return the key value represented by the event.
key() Return the key at the index in the storage. n The name of a key. Storage
keyCode Return the Unicode character code of the key that triggered the onkeypress, onkeydown, or onkeyup event. KeyboardEvent
keys() Return an array iteration object that contains the keys of the original array. Array
lang Set or return the value of the lang attribute of the element. Element
language Return the language of the browser. Navigator
lastChild Return the last child node of the element. Element
lastElementChild Return the last child element of the element. Element
lastIndex Specify the index where the next match starts. RegExp
lastIndexOf() Search for an element in the array from the end, and then return its position.
lastModified Return the date and time of the last modification of the document. Document
length Set or return the number of elements in the array.
lengthComputable Return whether the length of the progress is computable. ProgressEvent
let Declare variables within the scope of the square brackets {}. Statements
links Returns a collection of all <a> and <area> elements in the document that have an href attribute Document
LN2 Returns the natural logarithm of 2 (approximately 0.693). Math
LN10 Returns the natural logarithm of 10 (approximately 2.302). Math
loaded Returns the amount of work loaded. ProgressEvent
localeCompare() Compares two strings in the current locale environment. String
localStorage Allows key/value pairs to be stored in a web browser. Stores data without an expiration date. Window
location Returns the position of the key on the keyboard or device. KeyboardEvent
location Returns the Location object of the window (see Location Object) Window
log() Returns the natural logarithm of a number.
log10() Returns the logarithm (base 10) of a number. Math
log1p() Returns 1 + the natural logarithm of a number. Math
log2() Returns the logarithm (base 2) of a number. Math
LOG2E Returns the logarithm (base 2) of E (approximately 1.442). Math
LOG10E Returns the logarithm (base 10) of E (approximately 0.434). Math
map() Creates a new array and calls a function for each array element. Array
match() Searches for a match in a string with a regular expression and then returns the match. String
matches() Returns a boolean value indicating whether the element is matched by a specific CSS selector. Element
matchMedia() Returns the MediaQueryList object representing the specified CSS media query string. Window
max() Returns the number with the maximum value. Math
MAX_VALUE Returns the possibly largest number in JavaScript. Number
message Sets or returns the error message (string). Error
metaKey Returns whether the 'META' key was pressed at the time of the event trigger.
min() Returns the number with the minimum value. Math
multiline Checks if the 'm' modifier has been set. RegExp
MIN_VALUE Returns the possibly smallest number in JavaScript. Number
moveBy() Moves the window relative to the current position. Window
moveTo() Moves the window to the specified position. Window
MovementX Returns the horizontal coordinate of the mouse pointer relative to the position of the previous mousemove event. MouseEvent
MovementY Returns the vertical coordinate of the mouse pointer relative to the position of the previous mousemove event. MouseEvent
name Sets or returns the error name.
namedItem() Returns the element with the specified ID or name from the HTMLCollection. HTMLCollection
namespaceURI Returns the namespace URI of the element. Element
NaN Non-numeric ("Not-a-Number") values. Global, Number
navigator Returns the Navigator object of the window (see Navigator object) Window
NEGATIVE_INFINITY Represents negative infinity (returns when overflow) Number
new Creates an instance of the constructor.
newURL Returns the URL of the document after the hash change. HasChangeEvent
newValue Returns the new value of the changed storage item. StorageEvent
nextSibling Returns the next node in the same node tree level. Element
nextElementSibling Returns the next element in the same node tree level. Element
nodeName Returns the name of the node. Element
nodeType Returns the type of the node. Element
nodeValue Sets or returns the value of a node. Element
normalize() Removes empty Text nodes and connects adjacent nodes.
normalizeDocument() Removes empty Text nodes and connects adjacent nodes. Document
now() Returns the number of milliseconds since January 1, 1970, at midnight. Date
Number() Converts the value of an object to a number. Global
offsetHeight Returns the height of the element, including padding, border, and scrollbars. Element
offsetWidth Returns the width of the element, including padding, border, and scrollbars. Element
offsetLeft Returns the horizontal offset position of the element. Element
offsetParent Returns the offset container of the element. Element
offsetTop Returns the vertical offset position of the element. Element
offsetX Returns the horizontal coordinate of the mouse pointer relative to the edge of the target element. MouseEvent
offsetY Returns the vertical coordinate of the mouse pointer relative to the edge of the target element. MouseEvent
oldURL Returns the URL of the document before the hash change. HasChangeEvent
oldValue Returns the old value of the changed storage item. StorageEvent
onabort This event occurs when media loading is aborted.
onafterprint This event occurs when the page starts printing or the print dialog is closed. Event
onanimationend This event occurs when a CSS animation completes. AnimationEvent
onanimationiteration This event occurs during a repeating CSS animation. AnimationEvent
onanimationstart This event occurs when a CSS animation starts. AnimationEvent
onbeforeprint This event occurs when the page is about to be printed. Event
onbeforeunload 在文档即将被卸载之前发生此事件。
This event occurs before the document is unloaded. onblur FocusEvent
This event occurs when an element loses focus. oncanplay Event
This event occurs when the browser can start playing media (when it has enough buffering to start playing). oncanplaythrough Event
This event occurs when the browser can play media without stopping buffering. onchange Event
This event occurs when the content, selection, or selected state of a form element changes (for <input>, <select>, and <textarea>). onclick MouseEvent
This event occurs when the user clicks an element. oncontextmenu MouseEvent
This event occurs when the user right-clicks an element to open the context menu. oncopy ClipboardEvent
This event occurs when the user copies the content of an element. oncut ClipboardEvent
This event occurs when the user cuts the content of an element. ondblclick MouseEvent
This event occurs when the user double-clicks an element. ondrag This event occurs when the dragged element is placed on the drop target.
This event occurs while dragging the element. ondragend This event occurs when the dragged element is placed on the drop target.
This event occurs when the user finishes dragging the element. ondragenter This event occurs when the dragged element is placed on the drop target.
This event occurs when the dragged element enters the drop target. ondragleave This event occurs when the dragged element is placed on the drop target.
This event occurs when the dragged element leaves the drop target. ondragover This event occurs when the dragged element is placed on the drop target.
This event occurs when the dragged element is over the drop target. ondragstart This event occurs when the dragged element is placed on the drop target.
This event occurs when the user starts dragging an element. ondrop This event occurs when the dragged element is placed on the drop target.
DragEvent ondurationchange Event
This event occurs when the media duration changes. onemptied  
This event occurs when a bad situation occurs and the media file suddenly becomes unavailable (e.g., an unexpected disconnection). This event occurs when the media reaches the end. Event
onerror This event occurs after an error occurs while loading an external file.
onfocus This event occurs when an element gains focus. FocusEvent
onfocusin This event occurs when an element is about to gain focus. FocusEvent
onfocusout This event occurs when an element is about to lose focus. FocusEvent
onfullscreenchange This event occurs when an element is displayed in full-screen mode. Event
onfullscreenerror This event occurs when an element cannot be displayed in full-screen mode. Event
onhashchange This event occurs when the anchor part of the URL changes. HashChangeEvent
oninput This event occurs when an element receives user input.
oninvalid This event occurs when an element is invalid. Event
onkeydown This event occurs when the user presses a key. KeyboardEvent
onkeypress This event occurs when the user presses a key. KeyboardEvent
onkeyup This event occurs when the user releases a key. KeyboardEvent
onLine Determine whether the browser is online. Navigator
onload This event occurs when the object has been loaded.
onloadeddata This event occurs after the media data is loaded. Event
onloadedmetadata This event occurs when metadata (such as size and duration) is being loaded. Event
onloadstart This event occurs when the browser starts searching for the specified media. ProgressEvent
onmessage This event occurs when a message is received through this event source. Event
onmousedown This event occurs when the user presses the mouse button on an element. MouseEvent
onmouseenter This event occurs when the pointer moves onto an element. MouseEvent
onmouseleave This event occurs when the pointer moves out of an element. MouseEvent
onmousemove This event occurs when the pointer moves over an element. MouseEvent
onmouseover This event occurs when the pointer moves onto an element or any of its child elements. MouseEvent
onmouseout This event occurs when the user moves the mouse pointer out of an element or any of its child elements. MouseEvent
onmouseup This event occurs when the user releases the mouse button on an element. MouseEvent
onmousewheel Not recommended for use.Please use wheel Event. WheelEvent
onoffline This event occurs when the browser starts working offline. Event
ononline This event occurs when the browser starts working online. Event
onopen This event occurs when a connection with the event source is opened. Event
onpagehide This event occurs when the user leaves a webpage to navigate. PageTransitionEvent
onpageshow This event occurs when the user navigates to a webpage. PageTransitionEvent
onpaste This event occurs when the user pastes some content into an element. ClipboardEvent
onpause This event occurs when the media is paused by the user or paused programmatically. Event
onplay This event occurs when the media starts or is no longer paused. Event
onplaying This event occurs when the media is paused or stopped to buffer and then played back. Event
onpopstate This event occurs when the browser's history is changed. PopStateEvent
onprogress This event occurs when the browser is in the process of obtaining media data. Event
onratechange This event occurs when the playback speed of the media changes. Event
onresize This event occurs when the size of the document view is adjusted.
onreset This event occurs when a form is reset. Event
onscroll This event occurs when the scrollbar of a scrolling element is moved.
onsearch This event occurs when the user types content into a search field (for <input="search">). Event
onseeked This event occurs when the user finishes moving/skipping to a new position in the media. Event
onseeking This event occurs when the user begins to move/skip to a new position in the media. Event
onselect This event occurs after the user selects text (for <input> and <textarea>).
onshow This event occurs when the <menu> element is displayed as a context menu. Event
onstalled This event occurs when the browser tries to fetch media data but the data is not available. Event
onstorage This event occurs when the web storage area is updated. StorageEvent
onsubmit This event occurs when a form is submitted. Event
onsuspend This event occurs when the browser intentionally does not fetch media data. Event
ontimeupdate This event occurs when the playback position changes. Event
ontoggle This event occurs when the user opens or closes the <details> element. Event
ontouchcancel This event occurs when the touch is interrupted. TouchEvent
ontouchend This event occurs when a finger is lifted off the touch screen. TouchEvent
ontouchmove This event occurs when a finger is dragged on the screen. TouchEvent
ontouchstart This event occurs when a finger is placed on the touch screen. TouchEvent
ontransitionend This event occurs when the CSS transition is completed. TransitionEvent
onunload This event occurs after the page has unloaded (for <body>).
onvolumechange This event occurs when the volume of the media has changed. Event
onwaiting This event occurs when media has paused but is expected to resume. Event
onwheel This event occurs when the mouse wheel scrolls up or down over an element. WheelEvent
open() Opens an HTML output stream to collect the output of document.write().
opener Returns a reference to the window that created the current window. Window
origin Returns the protocol, hostname, and port number of the URL. Location
outerHeight Returns the height of the browser window, including the toolbar/scroll bar. Window
outerHTML Sets or returns the outer content of an element. Element
outerText Sets or returns the outer text content of a node and its descendants. Element
outerWidth Returns the width of the browser window, including the toolbar/scroll bar. Window
ownerDocument Returns the root element of the element (document object). Element
pageX Returns the horizontal coordinate of the mouse pointer relative to the document when the mouse event is triggered. MouseEvent
pageXOffset Returns the number of pixels the current document has scrolled from the top left corner of the window (horizontally). Window
pageY Returns the vertical coordinate of the mouse pointer relative to the document when the mouse event is triggered. MouseEvent
pageYOffset Returns the number of pixels the current document has scrolled from the top left corner of the window (vertically). Window
parent Returns the parent window of the current window. Window
parentNode Returns the parent node of the element. Element
parentElement Returns the parent element node of the element. Element
parse() Parses a date string and returns the number of milliseconds since January 1, 1970.
parseFloat() Parses a string and returns a floating-point number. Global
parseInt() Parses a string and returns an integer. Global
pathname Sets or returns the pathname of the URL. Location
persisted Returns whether the web page is cached by the browser. PageTransitionEvent
PI Returns PI (approximately 3.14). Math
pixelDepth Returns the color resolution of the screen (in bits per pixel). Screen
platform Returns the platform for which the browser was compiled. Navigator
pop() Removes the last element from the array and returns it. Array
port Sets or returns the port number of the URL. Location
position Returns the position of the related device at a given time. Geolocation
positionError Returns the reason for the error when using the geolocation device. Geolocation
positionOptions Describes an object that contains the options attribute, which is passed as a parameter to Geolocation.getCurrentPosition() and Geolocation.watchPosition(). Geolocation
POSITIVE_INFINITY Represents infinity (returns when overflow occurs). Number
preventDefault() If the event can be cancelled, it cancels it and does not execute the default operation of the event. Event
print() Prints the content of the current window. Window
product Returns the name of the browser engine. Navigator
propertyName Returns the name of the CSS properties associated with animations or transitions.
protocol Sets or returns the protocol of the URL. Location
prototype Allows you to add properties and methods to the Array object.
pseudoElement Returns the name of the pseudo-element for animations or transitions.
push() Add a new element to the end of the array and return the new length. Array
pow() Return the value of x as the power of y. Math
previousSibling Return the previous node at the same level of the node tree. Element
previousElementSibling Return the previous element at the same level of the node tree. Element
prompt() Display a dialog box that prompts the visitor to enter. Window
prototype Allow you to add properties and methods to the object. Number
querySelector() Return the first element that matches the specified CSS selector in the document.
querySelectorAll() Return a static NodeList that contains all elements matching the specified CSS selector in the document.
random() Return a random number between 0 and 1. Math
readyState Return the (loading) state of the document. Document
reduce() Reduce the value of the array to a single value (from left to right). Array
reduceRight() Reduce the value of the array to a single value (from right to left). Array
referrer Return the URL of the document that loaded the current document. Document
region MouseEvent
reload() Reload the current document. Location
remove() Remove the element from the DOM. Element
removeAttribute() Remove the specified attribute from the element. Element
removeAttributeNode() Delete the specified attribute node and return the deleted node. Element
removeChild() Remove a child node from the element. Element
removeEventListener() Remove the event handler added by the addEventListener() method. Element
removeItem() Delete the key from the storage. Storage
repeat Return whether a key is held down repeatedly. KeyboardEvent
repeat() Return a new string with a copy of the existing string with the specified number of duplicates. String
replace() Search for the specified value or regular expression in the string, and then return a new string that replaces the specified value.
replaceChild() Replace the child nodes in the element. Element
requestAnimationFrame() Request the browser to call the function to update the animation before the next repaint. Window
requestFullscreen() Display the element in full-screen mode. Element
resizeBy() Adjust the window to the specified pixel size. Window
resizeTo() Adjust the window to the specified width and height. Window
return Stop executing the function and return from the function. Statements
reverse() Reverse the order of elements in the array. Array
round() Round x to the nearest integer. Math
relatedTarget Return the element related to the element that triggered the mouse event.
removeEventListener() Remove the event handler from the document (added by addEventListener() method). Document
removeNamedItem() Remove the specified attribute node. Attribute
renameNode() Rename the specified node. Document
screen Return the Screen object of the window (see Screen Object). Window
screenLeft Return the horizontal coordinate of the window relative to the screen. Window
screenTop Return the vertical coordinate of the window relative to the screen. Window
screenX Return the horizontal coordinate of the window/mouse cursor relative to the screen.
screenY Return the vertical coordinate of the window/mouse cursor relative to the screen.
scripts Return a collection of <script> elements in the document. Document
scroll() Not recommended for use.This method has been replaced by scrollTo() Method instead. Window
scrollBy() Scroll the document by the specified number of pixels. Window
scrollHeight Return the entire height of the element, including padding. Element
scrollIntoView() Scroll the specified element into the visible area of the browser window. Element
scrollLeft Set or return the number of pixels horizontally scrolled in the element content. Element
scrollTo() Scroll the document to the specified coordinates. Window
scrollTop Set or return the number of pixels vertically scrolled in the element content. Element
scrollWidth Return the entire width of the element, including padding. Element
scrollX pageXOffset Alias. Window
scrollY pageYOffset Alias. Window
search Set or return the querystring part of the URL. Location
search() Search for a specified value or regular expression in a string and return the position of the match. String
self Return the current window. Window
sessionStorage Allow key/value pairs to be stored in a web browser. Store data for session storage. Window
setAttribute() Set or change the specified attribute to the specified value. Element
setAttributeNode() Set or change the specified attribute node. Element
setDate() Set the day of the month in the date object. Date
setFullYear() Set the year of the date object. Date
setHours() Set the hour of the date object. Date
setInterval() Invoke a function or calculate an expression at a specified time interval (in milliseconds). Window
setItem() Add a key to the storage or update the value of the key (if it already exists). Storage
setMilliseconds() Set the milliseconds of the date object. Date
setMinutes() Set the minutes of the date object. Date
setMonth() Set the month of the date object. Date
setNamedItem() Set the specified attribute node (by name). Attribute
setSeconds() Set the seconds of the date object. Date
setTime() Set the date to a specified number of milliseconds before or after January 1, 1970. Date
setTimeout() Call a function or calculate an expression after a specified number of milliseconds. Window
setUTCDate() Set the date of the date object according to world standard time. Date
setUTCFullYear() Set the year of the date object according to world standard time. Date
setUTCHours() Set the hours of the date object according to world standard time. Date
setUTCMilliseconds() Set the milliseconds of the date object according to world standard time. Date
setUTCMinutes() Set the minutes of the date object according to world standard time. Date
setUTCMonth() Set the month of the date object according to world standard time. Date
setUTCSeconds() Set the seconds of the date object according to world standard time. Date
setYear() Not recommended for use.Please use setFullYear() Method instead. Date
shift() Remove the first element of the array and return it. Array
shiftKey Return whether the 'SHIFT' key was pressed when the event was triggered.
sign(x) Return the sign of the number (check if it is positive, negative, or zero). Math
sin() Return the sine of x (x is in radians). Math
sinh() Return the hyperbolic sine of x. Math
slice() Select a part of the array and return a new array of this part.
some() Check if any element in the array passes the test. Array
sort() Sort the elements of the array. Array
source Return the text of the RegExp pattern. RegExp
specified Return true if the specified property is specified, otherwise return false. Attribute
splice() Add/remove elements from the array. Array
split() Split the string into an array of substrings. String
static Define a static method of the class. Classes
startsWith() Check if the string starts with the specified character. String
state Return an object that contains a copy of the history entry. PopStateEvent
String() Convert the value of the object to a string. Global
stop() Stop loading the window. Window
stopImmediatePropagation() Prevent other listeners from being called for the same event. Event
stopPropagation() Prevent the event from propagating further in the event flow. Event
stringify() Convert a JavaScript object to a JSON string. JSON
sqrt() Return the square root of x. Math
SQRT1_2 Return the square root of 1/2 (approximately 0.707). Math
SQRT2 Return the square root of 2 (approximately 1.414). Math
status Set or return the text in the window status bar. Window
strictErrorChecking Set or return whether to enforce error checking. Document
storageArea Return the object representing the affected storage object. StorageEvent
style Set or return the value of the element's style attribute. Element
substr() Extract characters from the string, starting from the specified starting position, up to the specified number of characters String
substring() Extract characters from the string between two specified indices. String
super Reference the superclass. Classes
switch Mark the block of statements to be executed based on different conditions. Statements
table() Display tabular data as a table. Console
tabIndex Set or return the value of the element's tabindex attribute. Element
tagName Return the tag name of the element. Element
tan() Return the tangent of an angle. Math
tanh() Return the hyperbolic tangent of a number. Math
target Return the element that triggered the event. Event
targetTouches Return a TouchList object that contains all touch points still in contact with the touch surface. TouchEvent
test() Test the match item in the string. Return true or false. RegExp
textContent Set or return the text content of the node and its descendants. Element
this Refers to its own object.
throw Throw (generate) an error. Statements
time() Start a timer (to track how long an operation takes). Console
timeEnd() Stop the timer started by console.time() before. Console
timeStamp Return the time when the event was created (in milliseconds relative to the epoch). Event
title Set or return the document title.
toDateString() Convert the date part of the Date object to a readable string. Date
toGMTString() Not recommended for use.Use toUTCString() Method instead. Date
toExponential() Converts a number to exponential notation. Number
toFixed(x) Formats a number with x digits after the decimal point. Number
toJSON() Returns a date as a string in JSON date format. Date
toISOString() Returns a date as a string using the ISO standard. Date
toLocaleDateString() Returns the date part of a Date object as a string using the locale conventions. Date
toLocaleLowerCase() Converts a string to lowercase letters based on the host's language environment. String
toLocaleString() Converts a Date object to a string using the locale conventions. Date
toLocaleTimeString() Returns the time part of a Date object as a string using the locale conventions. Date
toLocaleUpperCase() Converts a string to uppercase letters based on the host's language environment. String
toLowerCase() Converts a string to lowercase letters. String
top Returns the topmost browser window. Window
toPrecision(x) Formats a number as x digits long. Number
toString() Converts an array to a string and returns the result.
total Returns the total amount of work to be loaded. ProgressEvent
toTimeString() Converts the time part of a Date object to a string. Date
touches Returns a list of all touch objects currently in contact with the surface. TouchEvent
toUpperCase() Converts a string to uppercase letters. String
toUTCString() Converts a Date object to a string based on world standard time. Date
trace() Outputs the stack trace to the console. Console
transitionend This event occurs when a CSS transition is completed. TransitionEvent
trim() Removes whitespace from both ends of a string. String
trunc() Returns the integer part of the number (x). Math
try ... catch ... finally Marks a block of statements to be executed when an error occurs in a try block and implements error handling. Statements
type Returns the name of the event. Event
typeof Returns the type of a variable, object, function, or expression. Operators
undefined Indicates that a variable has not been assigned a value. Global
unescape() 1.5版中已弃用。改用decodeURI()decodeURIComponent() Global
unshift() 将新元素添加到数组的开头,并返回新的长度。 Array
url 返回已更改项目的文档的 URL。 StorageEvent
URL 返回 HTML 文档的完整 URL。 Document
userAgent 返回浏览器发送到服务器的用户代理标头。 Navigator
UTC() 根据UTC时间,返回自1970年1月1日午夜以来的日期中的毫秒数 Date
value 设置或返回属性的值。 Attribute
valueOf() 返回数组的原始值。
var 声明变量。 Statements
warn() 将警告消息输出到控制台。 Console
watchPosition() 返回监听 ID 值,然后将其传递给 Geolocation.clearWatch() 方法即可用于注销处理程序。 Geolocation
which Returns the mouse button pressed when the mouse event is triggered.
width Returns the total width of the screen. Screen
view Returns a reference to the Window object on which the event occurred. UiEvent
void Evaluate the expression and return undefined. Operators
while A block of statements to be executed when a condition is marked as true. Statements
write() Write HTML expressions or JavaScript code to the document. Document
writeln() Same as write(), but adds a newline character after each statement. Document
yield Pause and resume generator functions. Operators

JavaScript Tutorial

Please visit our JavaScript Tutorial