JavaScript Reference


Property/MethodDescriptionMember of
abs()Returns the absolute value of xMath
accessKeySets or returns the accesskey attribute of an elementElement
acos()Returns the arccosine of x, in radiansMath
acosh()Returns the hyperbolic arccosine of xMath
activeElementReturns the currently focused element in the documentDocument
addEventListener()Attaches an event handler to the documentDocument, Element
adoptNode()Adopts a node from another documentDocument
alert()Displays an alert box with a message and an OK buttonWindow
altKeyReturns whether the “ALT” key was pressed when the mouse event was triggeredMouseEvent, KeyboardEvent, TouchEvent
anchorsReturns a collection of all <a> elements in the document that have a name attributeDocument
animationNameReturns the name of the animationAnimationEvent
appCodeNameReturns the code name of the browserNavigator
appendChild()Adds a new child node, to an element, as the last child nodeElement
appletsReturns a collection of all <applet> elements in the documentDocument
appNameReturns the name of the browserNavigator
appVersionReturns the version information of the browserNavigator
asin()Returns the arcsine of x, in radiansMath
asinh()Returns the hyperbolic arcsine of xMath
assert()Writes an error message to the console if the assertion is falseConsole
assign()Loads a new documentLocation
atan()Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radiansMath
atan2()Returns the arctangent of the quotient of its argumentsMath
atanh()Returns the hyperbolic arctangent of xMath
atob()Decodes a base-64 encoded stringWindow
attributesReturns a NamedNodeMap of an element’s attributesElement
availHeightReturns the height of the screen (excluding the Windows Taskbar)Screen
availWidthReturns the width of the screen (excluding the Windows Taskbar)Screen
back()Loads the previous URL in the history listHistory
baseURIReturns the absolute base URI of a documentDocument
blur()Removes focus from an elementElement, Window
bodySets or returns the document’s body (the <body> element)Document
breakExits a switch or a loopStatements
btoa()Encodes a string in base-64Window
bubblesReturns whether or not a specific event is a bubbling eventEvent
buttonReturns which mouse button was pressed when the mouse event was triggeredMouseEvent
buttonsReturns which mouse buttons were pressed when the mouse event was triggeredMouseEvent
cancelableReturns whether or not an event can have its default action preventedEvent
cbrt()Returns the cubic root of xMath
ceil()Returns x, rounded upwards to the nearest integerMath
changeTouchesReturns a list of all the touch objects whose state changed between the previous touch and this touchTouchEvent
characterSetReturns the character encoding for the documentDocument
charAt()Returns the character at the specified index (position)String
charCodeReturns the Unicode character code of the key that triggered the onkeypress eventKeyboardEvent
charCodeAt()Returns the Unicode of the character at the specified indexString
charsetDeprecated. Use characterSet instead. Returns the character encoding for the documentDocument
childElementCountReturns the number of child elements an element hasElement
childNodesReturns a collection of an element’s child nodes (including text and comment nodes)Element
childrenReturns a collection of an element’s child element (excluding text and comment nodes)Element
classListReturns the class name(s) of an elementElement
classDeclares a classStatements
classNameSets or returns the value of the class attribute of an elementElement
clear()Clears the consoleConsole, Storage
clearInterval()Clears a timer set with setInterval()Window
clearTimeout()Clears a timer set with setTimeout()Window
clearWatch()Unregister location/error monitoring handlers previously installed using Geolocation.watchPosition()Geolocation
click()Simulates a mouse-click on an elementElement
clientHeightReturns the height of an element, including paddingElement
clientLeftReturns the width of the left border of an elementElement
clientTopReturns the width of the top border of an elementElement
clientWidthReturns the width of an element, including paddingElement
clientXReturns the horizontal coordinate of the mouse pointer, relative to the current window, when the mouse event was triggeredMouseEvent, TouchEvent
clientYReturns the vertical coordinate of the mouse pointer, relative to the current window, when the mouse event was triggeredMouseEvent, TouchEvent
clipboardDataReturns an object containing the data affected by the clipboard operationClipboardData
closedReturns a Boolean value indicating whether a window has been closed or notWindow
close()Closes the output stream previously opened with document.open()Document, Window
closest()Searches up the DOM tree for the closest element which matches a specified CSS selectorElement
clz32(x)Returns the number of leading zeros in a 32-bit binary representation of xMath
codeReturns the code of the key that triggered the eventKeyboardEvent
colorDepthReturns the bit depth of the color palette for displaying imagesScreen
compareDocumentPosition()Compares the document position of two elementsElement
compile()Deprecated in version 1.5. Compiles a regular expressionRegExp
composedReturns whether the event is composed or notEvent
concat()Joins two or more arrays, and returns a copy of the joined arraysArray, String
confirm()Displays a dialog box with a message and an OK and a Cancel buttonWindow
constDeclares a variable with a constant valueStatements
constructor()Creates and initialize objects created within a classClasses
constructorReturns the function that created the Array object’s prototypeArray, Boolean, Date, Number, RegExp
contains()Returns true if a node is a descendant of a node, otherwise falseElement
contentEditableSets or returns whether the content of an element is editable or notElement
continueBreaks one iteration (in the loop) if a specified condition occurs, and continues with the next iteration in the loopStatements
consoleReturns a reference to the Console object, which provides methods for logging information to the browser’s console (See Console object)Window
cookieReturns all name/value pairs of cookies in the documentDocument
cookieEnabledDetermines whether cookies are enabled in the browserNavigator
coordinatesReturns the position and altitude of the device on EarthGeolocation
copyWithin()Copies array elements within the array, to and from specified positionsArray
cos(x)Returns the cosine of x (x is in radians)Math
cosh(x)Returns the hyperbolic cosine of xMath
count()Logs the number of times that this particular call to count() has been calledConsole
createAttribute()Creates an attribute nodeDocument
createComment()Creates a Comment node with the specified textDocument
createDocumentFragment()Creates an empty DocumentFragment nodeDocument
createElement()Creates an Element nodeDocument
createEvent()Creates a new eventDocument, Event
createTextNode()Creates a Text nodeDocument
ctrlKeyReturns whether the “CTRL” key was pressed when the mouse event was triggeredMouseEvent, KeyboardEvent, TouchEvent
currentTargetReturns the element whose event listeners triggered the eventEvent
dataReturns the inserted charactersInputEvent
dataTransferReturns an object containing the data being dragged/dropped, or inserted/deletedDragEvent, InputEvent
debuggerStops the execution of JavaScript, and calls (if available) the debugging functionStatements
decodeURI()Decodes a URIGlobal
decodeURIComponent()Decodes a URI componentGlobal
defaultPreventedReturns whether or not the preventDefault() method was called for the eventEvent
defaultStatusSets or returns the default text in the statusbar of a windowWindow
defaultViewReturns the window object associated with a document, or null if none is available.Document
deleteDeletes a property from an objectOperators
deltaXReturns the horizontal scroll amount of a mouse wheel (x-axis)WheelEvent
deltaYReturns the vertical scroll amount of a mouse wheel (y-axis)WheelEvent
deltaZReturns the scroll amount of a mouse wheel for the z-axisWheelEvent
deltaModeReturns a number that represents the unit of measurements for delta values (pixels, lines or pages)WheelEvent
designModeControls whether the entire document should be editable or not.Document
detailReturns a number that indicates how many times the mouse was clickedUiEvent
do … whileExecutes a block of statements and repeats the block while a condition is trueStatements
doctypeReturns the Document Type Declaration associated with the documentDocument
documentReturns the Document object for the window (See Document object)Window
documentElementReturns the Document Element of the document (the <html> element)Document
documentModeReturns the mode used by the browser to render the documentDocument
documentURISets or returns the location of the documentDocument
domainReturns the domain name of the server that loaded the documentDocument
domConfigObsolete. Returns the DOM configuration of the documentDocument
elapsedTimeReturns the number of seconds an animation has been runningAnimationEvent
elapsedTimeReturns the number of seconds a transition has been running 
embedsReturns a collection of all <embed> elements the documentDocument
encodeURI()Encodes a URIGlobal
encodeURIComponent()Encodes a URI componentGlobal
EReturns Euler’s number (approx. 2.718)Math
endsWith()Checks whether a string ends with specified string/charactersString
entries()Returns a key/value pair Array Iteration ObjectArray
error()Outputs an error message to the consoleConsole
escape()Deprecated in version 1.5. Use encodeURI() or encodeURIComponent() insteadGlobal
eval()Evaluates a string and executes it as if it was script codeGlobal
eventPhaseReturns which phase of the event flow is currently being evaluatedEvent
every()Checks if every element in an array pass a testArray
exec()Tests for a match in a string. Returns the first matchRegExp
execCommand()Invokes the specified clipboard operation on the element currently having focus.Document
exitFullscreen()Cancels an element in fullscreen modeElement
exp(x)Returns the value of ExMath
expm1(x)Returns the value of Ex minus 1Math
exportExport functions so they can be used for imports in external modules, and other scripts
extendsExtends a class (inherit)Classes
dirSets or returns the value of the dir attribute of an elementElement
fill()Fill the elements in an array with a static valueArray
filter()Creates a new array with every element in an array that pass a testArray
find()Returns the value of the first element in an array that pass a testArray
findIndex()Returns the index of the first element in an array that pass a testArray
floor()Returns x, rounded downwards to the nearest integerMath
focus()Gives focus to an elementElement, Window
forMarks a block of statements to be executed as long as a condition is trueStatements
for … inMarks a block of statements to be executed for each element of an object (or array)Statements
forEach()Calls a function for each array elementArray
formsReturns a collection of all <form> elements in the documentDocument
forward()Loads the next URL in the history listHistory
frameElementReturns the <iframe> element in which the current window is insertedWindow
framesReturns all <iframe> elements in the current windowWindow
from()Creates an array from an objectArray
fromCharCode()Converts Unicode values to charactersString
fround()Returns the nearest (32-bit single precision) float representation of a numberMath
fullscreenElementReturns the current element that is displayed in fullscreen modeDocument
fullscreenEnabled()Returns a Boolean value indicating whether the document can be viewed in fullscreen modeDocument
functionDeclares a functionStatements
geolocationReturns a Geolocation object that can be used to locate the user’s positionNavigator
getDate()Returns the day of the month (from 1-31)Date
getDay()Returns the day of the week (from 0-6)Date
getAttribute()Returns the specified attribute value of an element nodeElement
getAttributeNode()Returns the specified attribute nodeElement
getBoundingClientRect()Returns the size of an element and its position relative to the viewportElement
getComputedStyle()Gets the current computed CSS styles applied to an elementWindow
getCurrentPosition()Returns the current position of the deviceGeolocation
getElementById()Returns the element that has the ID attribute with the specified valueDocument
getElementsByClassName()Returns a NodeList containing all elements with the specified class nameDocument, Element
getElementsByName()Returns a NodeList containing all elements with a specified nameDocument
getElementsByTagName()Returns a NodeList containing all elements with the specified tag nameDocument, Element
getFullYear()Returns the yearDate
getHours()Returns the hour (from 0-23)Date
getItem()Returns the value of the specified key nameStorage
getMilliseconds()Returns the milliseconds (from 0-999)Date
getMinutes()Returns the minutes (from 0-59)Date
getModifierState()Returns an array containing target ranges that will be affected by the insertion/deletionMouseEvent
getMonth()Returns the month (from 0-11)Date
getNamedItem()Returns a specified attribute node from a NamedNodeMapAttribute
getSeconds()Returns the seconds (from 0-59)Date
getSelection()Returns a Selection object representing the range of text selected by the userWindow
getTargetRanges()Returns an array containing target ranges that will be affected by the insertion/deletionInputEvent
getTime()Returns the number of milliseconds since midnight Jan 1 1970, and a specified dateDate
getTimezoneOffset()Returns the time difference between UTC time and local time, in minutesDate
getUTCDate()Returns the day of the month, according to universal time (from 1-31)Date
getUTCDay()Returns the day of the week, according to universal time (from 0-6)Date
getUTCFullYear()Returns the year, according to universal timeDate
getUTCHours()Returns the hour, according to universal time (from 0-23)Date
getUTCMilliseconds()Returns the milliseconds, according to universal time (from 0-999)Date
getUTCMinutes()Returns the minutes, according to universal time (from 0-59)Date
getUTCMonth()Returns the month, according to universal time (from 0-11)Date
getUTCSeconds()Returns the seconds, according to universal time (from 0-59)Date
getYear()Deprecated. Use the getFullYear() method insteadDate
globalChecks whether the “g” modifier is setRegExp
go()Loads a specific URL from the history listHistory
group()Creates a new inline group in the console. This indents following console messages by an additional level, until console.groupEnd() is calledConsole
groupCollapsed()Creates a new inline group in the console. However, the new group is created collapsed. The user will need to use the disclosure button to expand itConsole
groupEnd()Exits the current inline group in the consoleConsole
hasAttribute()Returns true if an element has the specified attribute, otherwise falseElement
hasAttributes()Returns true if an element has any attributes, otherwise falseElement
hasChildNodes()Returns true if an element has any child nodes, otherwise falseElement
hasFocus()Returns a Boolean value indicating whether the document has focusDocument
hashSets or returns the anchor part (#) of a URLLocation
headReturns the <head> element of the documentDocument
heightReturns the total height of the screenScreen
historyReturns the History object for the window (See History object)Window
hostSets or returns the hostname and port number of a URLLocation
hostnameSets or returns the hostname of a URLLocation
hrefSets or returns the entire URLLocation
idSets or returns the value of the id attribute of an elementElement
if … else … else ifMarks a block of statements to be executed depending on a conditionStatements
ignoreCaseChecks whether the “i” modifier is setRegExp
imagesReturns a collection of all <img> elements in the documentDocument
implementationReturns the DOMImplementation object that handles this documentDocument
importImport functions exported from an external module, and another script
importNode()Imports a node from another documentDocument
inReturns true if the specified property is in the specified object, otherwise falseOperators
includes()Check if an array contains the specified elementArray, String
indexOf()Search the array for an element and returns its positionArray, String
InfinityA numeric value that represents positive/negative infinityGlobal
info()Outputs an informational message to the consoleConsole
innerHeightReturns the height of the window’s content area (viewport) including scrollbarsWindow
innerHTMLSets or returns the content of an elementElement
innerTextSets or returns the text content of a node and its descendantsElement
innerWidthReturns the width of a window’s content area (viewport) including scrollbarsWindow
inputEncodingReturns the encoding, character set, used for the documentDocument
inputTypeReturns the type of the change (i.e “inserting” or “deleting”)InputEvent
insertAdjacentElement()Inserts a HTML element at the specified position relative to the current elementElement
insertAdjacentHTML()Inserts a HTML formatted text at the specified position relative to the current elementElement
insertAdjacentText()Inserts text into the specified position relative to the current elementElement
insertBefore()Inserts a new child node before a specified, existing, child nodeElement
instanceofReturns true if the specified object is an instance of the specified objectOperators
isArray()Checks whether an object is an arrayArray
isComposingReturns whether the state of the event is composing or notInputEvent, KeyboardEvent
isContentEditableReturns true if the content of an element is editable, otherwise falseElement
isDefaultNamespace()Returns true if a specified namespaceURI is the default, otherwise falseElement
isEqualNode()Checks if two elements are equalElement
isFinite()Determines whether a value is a finite, legal numberGlobal, Number
isIdReturns true if the attribute is of type Id, otherwise it returns falseAttribute
isInteger()Checks whether a value is an integerNumber
isNaN()Determines whether a value is an illegal numberGlobal, Number
isSafeInteger()Checks whether a value is a safe integerNumber
isSameNode()Checks if two elements are the same nodeElement
isSupported()Returns true if a specified feature is supported on the elementElement
isTrustedReturns whether or not an event is trustedEvent
item()Returns the attribute node at a specified index in a NamedNodeMapAttribute, HTMLCollection
join()Joins all elements of an array into a stringArray
keyReturns the key value of the key represented by the eventKeyboardEvent, StorageEvent
key()Returns the name of the nth key in the storageStorage
keyCodeReturns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup eventKeyboardEvent
keys()Returns a Array Iteration Object, containing the keys of the original arrayArray
langSets or returns the value of the lang attribute of an elementElement
languageReturns the language of the browserNavigator
lastChildReturns the last child node of an elementElement
lastElementChildReturns the last child element of an elementElement
lastIndexSpecifies the index at which to start the next matchRegExp
lastIndexOf()Search the array for an element, starting at the end, and returns its positionArray, String
lastModifiedReturns the date and time the document was last modifiedDocument
lengthSets or returns the number of elements in an arrayArray, Attribute, History, HTMLCollection, Window, Storage
lengthComputableReturns whether the length of the progress can be computable or notProgressEvent
letDeclares a variable inside brackets {} scopeStatements
linksReturns a collection of all <a> and <area> elements in the document that have a href attributeDocument
LN2Returns the natural logarithm of 2 (approx. 0.693)Math
LN10Returns the natural logarithm of 10 (approx. 2.302)Math
loadedReturns how much work has been loadedProgressEvent
localeCompare()Compares two strings in the current localeString
localStorageAllows to save key/value pairs in a web browser. Stores the data with no expiration dateWindow
locationReturns the location of a key on the keyboard or deviceKeyboardEvent
locationReturns the Location object for the window (See Location object)Window
log()Returns the natural logarithm of a numberMath, Console
log10()Returns the base-10 logarithm of a numberMath
log1p()Returns the natural logarithm of 1 + a numberMath
log2()Returns the base-2 logarithm of a numberMath
LOG2EReturns the base-2 logarithm of E (approx. 1.442)Math
LOG10EReturns the base-10 logarithm of E (approx. 0.434)Math
map()Creates a new array with the result of calling a function for each array elementArray
match()Searches a string for a match against a regular expression, and returns the matchesString
matches()Returns a Boolean value indicating whether an element is matched by a specific CSS selector or notElement
matchMedia()Returns a MediaQueryList object representing the specified CSS media query stringWindow
max()Returns the number with the highest valueMath
MAX_VALUEReturns the largest number possible in JavaScriptNumber
messageSets or returns an error message (a string)Error
metaKeyReturns whether the “META” key was pressed when an event was triggeredMouseEvent, KeyboardEvent, TouchEvent
min()Returns the number with the lowest valueMath
multilineChecks whether the “m” modifier is setRegExp
MIN_VALUEReturns the smallest number possible in JavaScriptNumber
moveBy()Moves a window relative to its current positionWindow
moveTo()Moves a window to the specified positionWindow
MovementXReturns the horizontal coordinate of the mouse pointer relative to the position of the last mousemove eventMouseEvent
MovementYReturns the vertical coordinate of the mouse pointer relative to the position of the last mousemove eventMouseEvent
nameSets or returns an error nameError, Attribute, Window
namedItem()Returns the element with the specified ID, or name, in an HTMLCollectionHTMLCollection
namespaceURIReturns the namespace URI of an elementElement
NaN“Not-a-Number” valueGlobal, Number
navigatorReturns the Navigator object for the window (See Navigator object)Window
NEGATIVE_INFINITYRepresents negative infinity (returned on overflow)Number
newCreates an instance of a constructor
newURLReturns the URL of the document, after the hash has been changedHasChangeEvent
newValueReturns the new value of the changed storage itemStorageEvent
nextSiblingReturns the next node at the same node tree levelElement
nextElementSiblingReturns the next element at the same node tree levelElement
nodeNameReturns the name of a nodeElement
nodeTypeReturns the node type of a nodeElement
nodeValueSets or returns the value of a nodeElement
normalize()Removes empty Text nodes, and joins adjacent nodesDocument, Element
normalizeDocument()Removes empty Text nodes, and joins adjacent nodesDocument
now()Returns the number of milliseconds since midnight Jan 1, 1970Date
Number()Converts an object’s value to a numberGlobal
offsetHeightReturns the height of an element, including padding, border and scrollbarElement
offsetWidthReturns the width of an element, including padding, border and scrollbarElement
offsetLeftReturns the horizontal offset position of an elementElement
offsetParentReturns the offset container of an elementElement
offsetTopReturns the vertical offset position of an elementElement
offsetXReturns the horizontal coordinate of the mouse pointer relative to the position of the edge of the target elementMouseEvent
offsetYReturns the vertical coordinate of the mouse pointer relative to the position of the edge of the target elementMouseEvent
oldURLReturns the URL of the document, before the hash was changedHasChangeEvent
oldValueReturns the old value of the changed storage itemStorageEvent
onabortThe event occurs when the loading of a media is abortedUiEvent, Event
onafterprintThe event occurs when a page has started printing, or if the print dialogue box has been closedEvent
onanimationendThe event occurs when a CSS animation has completedAnimationEvent
onanimationiterationThe event occurs when a CSS animation is repeatedAnimationEvent
onanimationstartThe event occurs when a CSS animation has startedAnimationEvent
onbeforeprintThe event occurs when a page is about to be printedEvent
onbeforeunloadThe event occurs before the document is about to be unloadedUiEvent, Event
onblurThe event occurs when an element loses focusFocusEvent
oncanplayThe event occurs when the browser can start playing the media (when it has buffered enough to begin)Event
oncanplaythroughThe event occurs when the browser can play through the media without stopping for bufferingEvent
onchangeThe event occurs when the content of a form element, the selection, or the checked state have changed (for <input>, <select>, and <textarea>)Event
onclickThe event occurs when the user clicks on an elementMouseEvent
oncontextmenuThe event occurs when the user right-clicks on an element to open a context menuMouseEvent
oncopyThe event occurs when the user copies the content of an elementClipboardEvent
oncutThe event occurs when the user cuts the content of an elementClipboardEvent
ondblclickThe event occurs when the user double-clicks on an elementMouseEvent
ondragThe event occurs when an element is being draggedDragEvent
ondragendThe event occurs when the user has finished dragging an elementDragEvent
ondragenterThe event occurs when the dragged element enters the drop targetDragEvent
ondragleaveThe event occurs when the dragged element leaves the drop targetDragEvent
ondragoverThe event occurs when the dragged element is over the drop targetDragEvent
ondragstartThe event occurs when the user starts to drag an elementDragEvent
ondropThe event occurs when the dragged element is dropped on the drop targetDragEvent
ondurationchangeThe event occurs when the duration of the media is changedEvent
onemptiedThe event occurs when something bad happens and the media file is suddenly unavailable (like unexpectedly disconnects) 
onendedThe event occurs when the media has reach the end (useful for messages like “thanks for listening”)Event
onerrorThe event occurs when an error occurs while loading an external fileProgressEvent, UiEvent, Event
onfocusThe event occurs when an element gets focusFocusEvent
onfocusinThe event occurs when an element is about to get focusFocusEvent
onfocusoutThe event occurs when an element is about to lose focusFocusEvent
onfullscreenchangeThe event occurs when an element is displayed in fullscreen modeEvent
onfullscreenerrorThe event occurs when an element can not be displayed in fullscreen modeEvent
onhashchangeThe event occurs when there has been changes to the anchor part of a URLHashChangeEvent
oninputThe event occurs when an element gets user inputInputEvent, Event
oninvalidThe event occurs when an element is invalidEvent
onkeydownThe event occurs when the user is pressing a keyKeyboardEvent
onkeypressThe event occurs when the user presses a keyKeyboardEvent
onkeyupThe event occurs when the user releases a keyKeyboardEvent
onLineDetermines whether the browser is onlineNavigator
onloadThe event occurs when an object has loadedUiEvent, Event
onloadeddataThe event occurs when media data is loadedEvent
onloadedmetadataThe event occurs when meta data (like dimensions and duration) are loadedEvent
onloadstartThe event occurs when the browser starts looking for the specified mediaProgressEvent
onmessageThe event occurs when a message is received through the event sourceEvent
onmousedownThe event occurs when the user presses a mouse button over an elementMouseEvent
onmouseenterThe event occurs when the pointer is moved onto an elementMouseEvent
onmouseleaveThe event occurs when the pointer is moved out of an elementMouseEvent
onmousemoveThe event occurs when the pointer is moving while it is over an elementMouseEvent
onmouseoverThe event occurs when the pointer is moved onto an element, or onto one of its childrenMouseEvent
onmouseoutThe event occurs when a user moves the mouse pointer out of an element, or out of one of its childrenMouseEvent
onmouseupThe event occurs when a user releases a mouse button over an elementMouseEvent
onmousewheelDeprecated. Use the wheel event insteadWheelEvent
onofflineThe event occurs when the browser starts to work offlineEvent
ononlineThe event occurs when the browser starts to work onlineEvent
onopenThe event occurs when a connection with the event source is openedEvent
onpagehideThe event occurs when the user navigates away from a webpagePageTransitionEvent
onpageshowThe event occurs when the user navigates to a webpagePageTransitionEvent
onpasteThe event occurs when the user pastes some content in an elementClipboardEvent
onpauseThe event occurs when the media is paused either by the user or programmaticallyEvent
onplayThe event occurs when the media has been started or is no longer pausedEvent
onplayingThe event occurs when the media is playing after having been paused or stopped for bufferingEvent
onpopstateThe event occurs when the window’s history changesPopStateEvent
onprogressThe event occurs when the browser is in the process of getting the media data (downloading the media)Event
onratechangeThe event occurs when the playing speed of the media is changedEvent
onresizeThe event occurs when the document view is resizedUiEvent, Event
onresetThe event occurs when a form is resetEvent
onscrollThe event occurs when an element’s scrollbar is being scrolledUiEvent, Event
onsearchThe event occurs when the user writes something in a search field (for <input=”search”>)Event
onseekedThe event occurs when the user is finished moving/skipping to a new position in the mediaEvent
onseekingThe event occurs when the user starts moving/skipping to a new position in the mediaEvent
onselectThe event occurs after the user selects some text (for <input> and <textarea>)UiEvent, Event
onshowThe event occurs when a <menu> element is shown as a context menuEvent
onstalledThe event occurs when the browser is trying to get media data, but data is not availableEvent
onstorageThe event occurs when a Web Storage area is updatedStorageEvent
onsubmitThe event occurs when a form is submittedEvent
onsuspendThe event occurs when the browser is intentionally not getting media dataEvent
ontimeupdateThe event occurs when the playing position has changed (like when the user fast forwards to a different point in the media)Event
ontoggleThe event occurs when the user opens or closes the <details> elementEvent
ontouchcancelThe event occurs when the touch is interruptedTouchEvent
ontouchendThe event occurs when a finger is removed from a touch screenTouchEvent
ontouchmoveThe event occurs when a finger is dragged across the screenTouchEvent
ontouchstartThe event occurs when a finger is placed on a touch screenTouchEvent
ontransitionendThe event occurs when a CSS transition has completedTransitionEvent
onunloadThe event occurs once a page has unloaded (for <body>)UiEvent, Event
onvolumechangeThe event occurs when the volume of the media has changed (includes setting the volume to “mute”)Event
onwaitingThe event occurs when the media has paused but is expected to resume (like when the media pauses to buffer more data)Event
onwheelThe event occurs when the mouse wheel rolls up or down over an elementWheelEvent
open()Opens an HTML output stream to collect output from document.write()Document, Window
openerReturns a reference to the window that created the windowWindow
originReturns the protocol, hostname and port number of a URLLocation
outerHeightReturns the height of the browser window, including toolbars/scrollbarsWindow
outerHTMLSets or returns the outer content of an elementElement
outerTextSets or returns the text outer content of a node and its descendantsElement
outerWidthReturns the width of the browser window, including toolbars/scrollbarsWindow
ownerDocumentReturns the root element (document object) for an elementElement
pageXReturns the horizontal coordinate of the mouse pointer, relative to the document, when the mouse event was triggeredMouseEvent
pageXOffsetReturns the pixels the current document has been scrolled (horizontally) from the upper left corner of the windowWindow
pageYReturns the vertical coordinate of the mouse pointer, relative to the document, when the mouse event was triggeredMouseEvent
pageYOffsetReturns the pixels the current document has been scrolled (vertically) from the upper left corner of the windowWindow
parentReturns the parent window of the current windowWindow
parentNodeReturns the parent node of an elementElement
parentElementReturns the parent element node of an elementElement
parse()Parses a date string and returns the number of milliseconds since January 1, 1970Date, JSON
parseFloat()Parses a string and returns a floating point numberGlobal
parseInt()Parses a string and returns an integerGlobal
pathnameSets or returns the path name of a URLLocation
persistedReturns whether the webpage was cached by the browserPageTransitionEvent
PIReturns PI (approx. 3.14)Math
pixelDepthReturns the color resolution (in bits per pixel) of the screenScreen
platformReturns for which platform the browser is compiledNavigator
pop()Removes the last element of an array, and returns that elementArray
portSets or returns the port number of a URLLocation
positionReturns the position of the concerned device at a given timeGeolocation
positionErrorReturns the reason of an error occurring when using the geolocating deviceGeolocation
positionOptionsDescribes an object containing option properties to pass as a parameter of Geolocation.getCurrentPosition() and Geolocation.watchPosition()Geolocation
POSITIVE_INFINITYRepresents infinity (returned on overflow)Number
preventDefault()Cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occurEvent
print()Prints the content of the current windowWindow
productReturns the engine name of the browserNavigator
propertyNameReturns the name of the CSS property associated with the animation or transitionAnimationEvent, TransitionEvent
protocolSets or returns the protocol of a URLLocation
prototypeAllows you to add properties and methods to an Array objectArray, Boolean, Date
pseudoElementReturns the name of the pseudo-element of the animation or transitionAnimationEvent, TransitionEvent
push()Adds new elements to the end of an array, and returns the new lengthArray
querySelector()Returns the first element that matches a specified CSS selector(s) in the documentDocument, Element
querySelectorAll()Returns a static NodeList containing all elements that matches a specified CSS selector(s) in the documentDocument, Element
random()Returns a random number between 0 and 1Math
readyStateReturns the (loading) status of the documentDocument
reduce()Reduce the values of an array to a single value (going left-to-right)Array
reduceRight()Reduce the values of an array to a single value (going right-to-left)Array
referrerReturns the URL of the document that loaded the current documentDocument
regionMouseEvent
reload()Reloads the current documentLocation
remove()Removes the element from the DOMElement
removeAttribute()Removes a specified attribute from an elementElement
removeAttributeNode()Removes a specified attribute node, and returns the removed nodeElement
removeChild()Removes a child node from an elementElement
removeEventListener()Removes an event handler that has been attached with the addEventListener() methodElement
removeItem()Removes that key from the storageStorage
repeatReturns whether a key is being hold down repeatedly, or notKeyboardEvent
repeat()Returns a new string with a specified number of copies of an existing stringString
replace()Searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replacedString, Location
replaceChild()Replaces a child node in an elementElement
requestAnimationFrame()Requests the browser to call a function to update an animation before the next repaintWindow
requestFullscreen()Shows an element in fullscreen modeElement
resizeBy()Resizes the window by the specified pixelsWindow
resizeTo()Resizes the window to the specified width and heightWindow
returnStops the execution of a function and returns a value from that functionStatements
reverse()Reverses the order of the elements in an arrayArray
round()Rounds x to the nearest integerMath
pow()Returns the value of x to the power of yMath
previousSiblingReturns the previous node at the same node tree levelElement
previousElementSiblingReturns the previous element at the same node tree levelElement
prompt()Displays a dialog box that prompts the visitor for inputWindow
prototypeAllows you to add properties and methods to an objectNumber
relatedTargetReturns the element related to the element that triggered the mouse eventMouseEvent, FocusEvent
removeEventListener()Removes an event handler from the document (that has been attached with the addEventListener() method)Document
removeNamedItem()Removes a specified attribute nodeAttribute
renameNode()Renames the specified nodeDocument
screenReturns the Screen object for the window (See Screen object)Window
screenLeftReturns the horizontal coordinate of the window relative to the screenWindow
screenTopReturns the vertical coordinate of the window relative to the screenWindow
screenXReturns the horizontal coordinate of the window/mouse pointer relative to the screenWindow, MouseEvent
screenYReturns the vertical coordinate of the window/mouse pointer relative to the screenWindow, MouseEvent
scriptsReturns a collection of <script> elements in the documentDocument
scroll()Deprecated. This method has been replaced by the scrollTo() method.Window
scrollBy()Scrolls the document by the specified number of pixelsWindow
scrollHeightReturns the entire height of an element, including paddingElement
scrollIntoView()Scrolls the specified element into the visible area of the browser windowElement
scrollLeftSets or returns the number of pixels an element’s content is scrolled horizontallyElement
scrollTo()Scrolls the document to the specified coordinatesWindow
scrollTopSets or returns the number of pixels an element’s content is scrolled verticallyElement
scrollWidthReturns the entire width of an element, including paddingElement
scrollXAn alias of pageXOffsetWindow
scrollYAn alias of pageYOffsetWindow
searchSets or returns the querystring part of a URLLocation
search()Searches a string for a specified value, or regular expression, and returns the position of the matchString
selfReturns the current windowWindow
sessionStorageAllows to save key/value pairs in a web browser. Stores the data for one sessionWindow
setAttribute()Sets or changes the specified attribute, to the specified valueElement
setAttributeNode()Sets or changes the specified attribute nodeElement
setDate()Sets the day of the month of a date objectDate
setFullYear()Sets the year of a date objectDate
setHours()Sets the hour of a date objectDate
setInterval()Calls a function or evaluates an expression at specified intervals (in milliseconds)Window
setItem()Adds that key to the storage, or update that key’s value if it already existsStorage
setMilliseconds()Sets the milliseconds of a date objectDate
setMinutes()Set the minutes of a date objectDate
setMonth()Sets the month of a date objectDate
setNamedItem()Sets the specified attribute node (by name)Attribute
setSeconds()Sets the seconds of a date objectDate
setTime()Sets a date to a specified number of milliseconds after/before January 1, 1970Date
setTimeout()Calls a function or evaluates an expression after a specified number of millisecondsWindow
setUTCDate()Sets the day of the month of a date object, according to universal timeDate
setUTCFullYear()Sets the year of a date object, according to universal timeDate
setUTCHours()Sets the hour of a date object, according to universal timeDate
setUTCMilliseconds()Sets the milliseconds of a date object, according to universal timeDate
setUTCMinutes()Set the minutes of a date object, according to universal timeDate
setUTCMonth()Sets the month of a date object, according to universal timeDate
setUTCSeconds()Set the seconds of a date object, according to universal timeDate
setYear()Deprecated. Use the setFullYear() method insteadDate
shift()Removes the first element of an array, and returns that elementArray
shiftKeyReturns whether the “SHIFT” key was pressed when an event was triggeredMouseEvent, KeyboardEvent, TouchEvent
sign(x)Returns the sign of a number (checks whether it is positive, negative or zero)Math
sin()Returns the sine of x (x is in radians)Math
sinh()Returns the hyperbolic sine of xMath
slice()Selects a part of an array, and returns the new arrayArray, String
some()Checks if any of the elements in an array pass a testArray
sort()Sorts the elements of an arrayArray
sourceReturns the text of the RegExp patternRegExp
specifiedReturns true if the attribute has been specified, otherwise it returns falseAttribute
splice()Adds/Removes elements from an arrayArray
split()Splits a string into an array of substringsString
staticDefines a static method for a classClasses
startsWith()Checks whether a string begins with specified charactersString
stateReturns an object containing a copy of the history entriesPopStateEvent
String()Converts an object’s value to a stringGlobal
stop()Stops the window from loadingWindow
stopImmediatePropagation()Prevents other listeners of the same event from being calledEvent
stopPropagation()Prevents further propagation of an event during event flowEvent
stringify()Convert a JavaScript object to a JSON stringJSON
sqrt()Returns the square root of xMath
SQRT1_2Returns the square root of 1/2 (approx. 0.707)Math
SQRT2Returns the square root of 2 (approx. 1.414)Math
statusSets or returns the text in the statusbar of a windowWindow
strictErrorCheckingSets or returns whether error-checking is enforced or notDocument
storageAreaReturns an object representing the affected storage objectStorageEvent
styleSets or returns the value of the style attribute of an elementElement
substr()Extracts the characters from a string, beginning at a specified start position, and through the specified number of characterString
substring()Extracts the characters from a string, between two specified indicesString
superRefers to the parent classClasses
switchMarks a block of statements to be executed depending on different casesStatements
table()Displays tabular data as a tableConsole
tabIndexSets or returns the value of the tabindex attribute of an elementElement
tagNameReturns the tag name of an elementElement
tan()Returns the tangent of an angleMath
tanh()Returns the hyperbolic tangent of a numberMath
targetReturns the element that triggered the eventEvent
targetTouchesReturns a list of all the touch objects that are in contact with the surface and where the touchstart event occured on the same target element as the current target elementTouchEvent
test()Tests for a match in a string. Returns true or falseRegExp
textContentSets or returns the textual content of a node and its descendantsElement
thisRefers to the object it belongs to
throwThrows (generates) an errorStatements
time()Starts a timer (can track how long an operation takes)Console
timeEnd()Stops a timer that was previously started by console.time()Console
timeStampReturns the time (in milliseconds relative to the epoch) at which the event was createdEvent
titleSets or returns the title of the documentDocument, Element
toDateString()Converts the date portion of a Date object into a readable stringDate
toGMTString()Deprecated. Use the toUTCString() method insteadDate
toExponential()Converts a number into an exponential notationNumber
toFixed(x)Formats a number with x numbers of digits after the decimal pointNumber
toJSON()Returns the date as a string, formatted as a JSON dateDate
toISOString()Returns the date as a string, using the ISO standardDate
toLocaleDateString()Returns the date portion of a Date object as a string, using locale conventionsDate
toLocaleLowerCase()Converts a string to lowercase letters, according to the host’s localeString
toLocaleString()Converts a Date object to a string, using locale conventionsDate
toLocaleTimeString()Returns the time portion of a Date object as a string, using locale conventionsDate
toLocaleUpperCase()Converts a string to uppercase letters, according to the host’s localeString
toLowerCase()Converts a string to lowercase lettersString
topReturns the topmost browser windowWindow
toPrecision(x)Formats a number to x lengthNumber
toString()Converts an array to a string, and returns the resultArray, Boolean, Date, Number, RegExp, String, Element
totalReturns the total amount of work that will be loadedProgressEvent
toTimeString()Converts the time portion of a Date object to a stringDate
touchesReturns a list of all the touch objects that are currently in contact with the surfaceTouchEvent
toUpperCase()Converts a string to uppercase lettersString
toUTCString()Converts a Date object to a string, according to universal timeDate
trace()Outputs a stack trace to the consoleConsole
transitionendThe event occurs when a CSS transition has completedTransitionEvent
trim()Removes whitespace from both ends of a stringString
trunc()Returns the integer part of a number (x)Math
try … catch … finallyMarks the block of statements to be executed when an error occurs in a try block, and implements error handlingStatements
typeReturns the name of the eventEvent
typeofReturns the type of a variable, object, function or expressionOperators
undefinedIndicates that a variable has not been assigned a valueGlobal
unescape()Deprecated in version 1.5. Use decodeURI() or decodeURIComponent() insteadGlobal
unshift()Adds new elements to the beginning of an array, and returns the new lengthArray
urlReturns the URL of the changed item’s documentStorageEvent
URLReturns the full URL of the HTML documentDocument
userAgentReturns the user-agent header sent by the browser to the serverNavigator
UTC()Returns the number of milliseconds in a date since midnight of January 1, 1970, according to UTC timeDate
valueSets or returns the value of the attributeAttribute
valueOf()Returns the primitive value of an arrayArray, Boolean, Date, Number, String
varDeclares a variableStatements
warn()Outputs a warning message to the consoleConsole
watchPosition()Returns a watch ID value that then can be used to unregister the handler by passing it to the Geolocation.clearWatch() methodGeolocation
whichReturns which mouse button was pressed when the mouse event was triggeredMouseEvent, KeyboardEvent
widthReturns the total width of the screenScreen
viewReturns a reference to the Window object where the event occurredUiEvent
voidEvaluates an expression and returns undefinedOperators
whileMarks a block of statements to be executed while a condition is trueStatements
write()Writes HTML expressions or JavaScript code to a documentDocument
writeln()Same as write(), but adds a newline character after each statementDocument
yieldPauses and resumes a generator functionOperators