目录

JavaScript 参考


按字母顺序排列的 JavaScript 参考

Property/Method Description Belongs To
abs() Returns the absolute value of x Math
accessKey Sets or returns the accesskey attribute of an element Element
acos() Returns the arccosine of x, in radians Math
acosh() Returns the hyperbolic arccosine of x Math
activeElement Returns the currently focused element in the document Document
addEventListener() Attaches an event handler to the document Document, Element
adoptNode() Adopts a node from another document Document
alert() Displays an alert box with a message and an OK button Window
altKey Returns whether the "ALT" key was pressed when the mouse event was triggered MouseEvent, KeyboardEvent, TouchEvent
anchors Returns a collection of all <a> elements in the document that have a name attribute Document
animationName Returns the name of the animation AnimationEvent
appCodeName Returns the code name of the browser Navigator
appendChild() Adds a new child node, to an element, as the last child node Element
applets Returns a collection of all <applet> elements in the document Document
appName Returns the name of the browser Navigator
appVersion Returns the version information of the browser Navigator
asin() Returns the arcsine of x, in radians Math
asinh() Returns the hyperbolic arcsine of x Math
assert() Writes an error message to the console if the assertion is false Console
assign() Loads a new document Location
atan() Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians Math
atan2() Returns the arctangent of the quotient of its arguments Math
atanh() Returns the hyperbolic arctangent of x Math
atob() Decodes a base-64 encoded string Window
attributes Returns a NamedNodeMap of an element's attributes Element
availHeight Returns the height of the screen (excluding the Windows Taskbar) Screen
availWidth Returns the width of the screen (excluding the Windows Taskbar) Screen
back() Loads the previous URL in the history list History
baseURI Returns the absolute base URI of a document Document
blur() Removes focus from an element Element, Window
body Sets or returns the document's body (the <body> element) Document
break Exits a switch or a loop Statements
btoa() Encodes a string in base-64 Window
bubbles Returns whether or not a specific event is a bubbling event Event
button Returns which mouse button was pressed when the mouse event was triggered MouseEvent
buttons Returns which mouse buttons were pressed when the mouse event was triggered MouseEvent
cancelable Returns whether or not an event can have its default action prevented Event
cbrt() Returns the cubic root of x Math
ceil() Returns x, rounded upwards to the nearest integer Math
changeTouches Returns a list of all the touch objects whose state changed between the previous touch and this touch TouchEvent
characterSet Returns the character encoding for the document Document
charAt() Returns the character at the specified index (position) String
charCode Returns the Unicode character code of the key that triggered the onkeypress event KeyboardEvent
charCodeAt() Returns the Unicode of the character at the specified index String
charset Deprecated. Use characterSet instead. Returns the character encoding for the document Document
childElementCount Returns the number of child elements an element has Element
childNodes Returns a collection of an element's child nodes (including text and comment nodes) Element
children Returns a collection of an element's child element (excluding text and comment nodes) Element
classList Returns the class name(s) of an element Element
class Declares a class Statements
className Sets or returns the value of the class attribute of an element Element
clear() Clears the console Console, 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 element Element
clientHeight Returns the height of an element, including padding Element
clientLeft Returns the width of the left border of an element Element
clientTop Returns the width of the top border of an element Element
clientWidth Returns the width of an element, including padding Element
clientX Returns the horizontal coordinate of the mouse pointer, relative to the current window, when the mouse event was triggered MouseEvent, TouchEvent
clientY Returns the vertical coordinate of the mouse pointer, relative to the current window, when the mouse event was triggered MouseEvent, TouchEvent
clipboardData Returns an object containing the data affected by the clipboard operation ClipboardData
closed Returns a Boolean value indicating whether a window has been closed or not Window
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 selector Element
clz32(x) Returns the number of leading zeros in a 32-bit binary representation of x Math
code Returns the code of the key that triggered the event KeyboardEvent
colorDepth Returns the bit depth of the color palette for displaying images Screen
compareDocumentPosition() Compares the document position of two elements Element
compile() Deprecated in version 1.5. Compiles a regular expression RegExp
composed Returns whether the event is composed or not Event
concat() Joins two or more arrays, and returns a copy of the joined arrays Array, String
confirm() Displays a dialog box with a message and an OK and a Cancel button Window
const Declares a variable with a constant value Statements
constructor() Creates and initialize objects created within a class Classes
constructor Returns the function that created the Array object's prototype Array, Boolean, Date, Number, RegExp
contains() Returns true if a node is a descendant of a node, otherwise false Element
contentEditable Sets or returns whether the content of an element is editable or not Element
continue Breaks one iteration (in the loop) if a specified condition occurs, and continues with the next iteration in the loop Statements
console Returns a reference to the Console object, which provides methods for logging information to the browser's console (See Console object) Window
cookie Returns all name/value pairs of cookies in the document Document
cookieEnabled Determines whether cookies are enabled in the browser Navigator
coordinates Returns the position and altitude of the device on Earth Geolocation
copyWithin() Copies array elements within the array, to and from specified positions Array
cos(x) Returns the cosine of x (x is in radians) Math
cosh(x) Returns the hyperbolic cosine of x Math
count() Logs the number of times that this particular call to count() has been called Console
createAttribute() Creates an attribute node Document
createComment() Creates a Comment node with the specified text Document
createDocumentFragment() Creates an empty DocumentFragment node Document
createElement() Creates an Element node Document
createEvent() Creates a new event Document, Event
createTextNode() Creates a Text node Document
ctrlKey Returns whether the "CTRL" key was pressed when the mouse event was triggered MouseEvent, KeyboardEvent, TouchEvent
currentTarget Returns the element whose event listeners triggered the event Event
data Returns the inserted characters InputEvent
dataTransfer Returns an object containing the data being dragged/dropped, or inserted/deleted DragEvent, InputEvent
debugger Stops the execution of JavaScript, and calls (if available) the debugging function Statements
decodeURI() Decodes a URI Global
decodeURIComponent() Decodes a URI component Global
defaultPrevented Returns whether or not the preventDefault() method was called for the event Event
defaultStatus Sets or returns the default text in the statusbar of a window Window
defaultView Returns the window object associated with a document, or null if none is available. Document
delete Deletes a property from an object Operators
deltaX Returns the horizontal scroll amount of a mouse wheel (x-axis) WheelEvent
deltaY Returns the vertical scroll amount of a mouse wheel (y-axis) WheelEvent
deltaZ Returns the scroll amount of a mouse wheel for the z-axis WheelEvent
deltaMode Returns a number that represents the unit of measurements for delta values (pixels, lines or pages) WheelEvent
designMode Controls whether the entire document should be editable or not. Document
detail Returns a number that indicates how many times the mouse was clicked UiEvent
do ... while Executes a block of statements and repeats the block while a condition is true Statements
doctype Returns the Document Type Declaration associated with the document Document
document Returns the Document object for the window (See Document object) Window
documentElement Returns the Document Element of the document (the <html> element) Document
documentMode Returns the mode used by the browser to render the document Document
documentURI Sets or returns the location of the document Document
domain Returns the domain name of the server that loaded the document Document
domConfig Obsolete. Returns the DOM configuration of the document Document
elapsedTime Returns the number of seconds an animation has been running AnimationEvent
elapsedTime Returns the number of seconds a transition has been running  
embeds Returns a collection of all <embed> elements the document Document
encodeURI() Encodes a URI Global
encodeURIComponent() Encodes a URI component Global
E Returns Euler's number (approx. 2.718) Math
endsWith() Checks whether a string ends with specified string/characters String
entries() Returns a key/value pair Array Iteration Object Array
error() Outputs an error message to the console Console
escape() Deprecated in version 1.5. Use encodeURI() or encodeURIComponent() instead Global
eval() Evaluates a string and executes it as if it was script code Global
eventPhase Returns which phase of the event flow is currently being evaluated Event
every() Checks if every element in an array pass a test Array
exec() Tests for a match in a string. Returns the first match RegExp
execCommand() Invokes the specified clipboard operation on the element currently having focus. Document
exitFullscreen() Cancels an element in fullscreen mode Element
exp(x) Returns the value of Ex Math
expm1(x) Returns the value of Ex minus 1 Math
export Export functions so they can be used for imports in external modules, and other scripts
extends Extends a class (inherit) Classes
dir Sets or returns the value of the dir attribute of an element Element
fill() Fill the elements in an array with a static value Array
filter() Creates a new array with every element in an array that pass a test Array
find() Returns the value of the first element in an array that pass a test Array
findIndex() Returns the index of the first element in an array that pass a test Array
floor() Returns x, rounded downwards to the nearest integer Math
focus() Gives focus to an element Element, Window
for Marks a block of statements to be executed as long as a condition is true Statements
for ... in Marks a block of statements 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 in which the current window is inserted Window
frames Returns all <iframe> elements in the current window Window
from() Creates an array from an object Array
fromCharCode() Converts Unicode values to characters String
fround() Returns the nearest (32-bit single precision) float representation of a number Math
fullscreenElement Returns the current element that is displayed in fullscreen mode Document
fullscreenEnabled() Returns a Boolean value indicating whether the document can be viewed in fullscreen mode Document
function Declares a function Statements
geolocation Returns a Geolocation object that can be used to locate the user's position Navigator
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 node Element
getAttributeNode() Returns the specified attribute node Element
getBoundingClientRect() Returns the size of an element and its position relative to the viewport Element
getComputedStyle() Gets the current computed CSS styles applied to an element Window
getCurrentPosition() Returns the current position of the device Geolocation
getElementById() Returns the element that has the ID attribute with the specified value Document
getElementsByClassName() Returns a NodeList containing all elements with the specified class name Document, Element
getElementsByName() Returns a NodeList containing all elements with a specified name Document
getElementsByTagName() Returns a NodeList containing all elements with the specified tag name Document, Element
getFullYear() Returns the year Date
getHours() Returns the hour (from 0-23) Date
getItem() Returns the value of the specified key name Storage
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/deletion MouseEvent
getMonth() Returns the month (from 0-11) Date
getNamedItem() Returns a specified attribute node from a NamedNodeMap Attribute
getSeconds() Returns the seconds (from 0-59) Date
getSelection() Returns a Selection object representing the range of text selected by the user Window
getTargetRanges() Returns an array containing target ranges that will be affected by the insertion/deletion InputEvent
getTime() Returns the number of milliseconds since midnight Jan 1 1970, and a specified date Date
getTimezoneOffset() Returns the time difference between UTC time and local time, in minutes Date
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 time Date
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 instead Date
global Checks whether the "g" modifier is set RegExp
go() Loads a specific URL from the history list History
group() Creates a new inline group in the console. This indents following console messages by an additional level, until console.groupEnd() is called Console
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 it Console
groupEnd() Exits the current inline group in the console Console
hasAttribute() Returns true if an element has the specified attribute, otherwise false Element
hasAttributes() Returns true if an element has any attributes, otherwise false Element
hasChildNodes() Returns true if an element has any child nodes, otherwise false Element
hasFocus() Returns a Boolean value indicating whether the document has focus Document
hash Sets or returns the anchor part (#) of a URL Location
head Returns the <head> element of the document Document
height Returns the total height of the screen Screen
history Returns the History object for the window (See History object) Window
host Sets or returns the hostname and port number of a URL Location
hostname Sets or returns the hostname of a URL Location
href Sets or returns the entire URL Location
id Sets or returns the value of the id attribute of an element Element
if ... else ... else if Marks a block of statements to be executed depending on a condition Statements
ignoreCase Checks whether the "i" modifier is set RegExp
images Returns a collection of all <img> elements in the document Document
implementation Returns the DOMImplementation object that handles this document Document
import Import functions exported from an external module, and another script
importNode() Imports a node from another document Document
in Returns true if the specified property is in the specified object, otherwise false Operators
includes() Check if an array contains the specified element Array, String
indexOf() Search the array for an element and returns its position Array, String
Infinity A numeric value that represents positive/negative infinity Global
info() Outputs an informational message to the console Console
innerHeight Returns the height of the window's content area (viewport) including scrollbars Window
innerHTML Sets or returns the content of an element Element
innerText Sets or returns the text content of a node and its descendants Element
innerWidth Returns the width of a window's content area (viewport) including scrollbars Window
inputEncoding Returns the encoding, character set, used for the document Document
inputType Returns the type of the change (i.e "inserting" or "deleting") InputEvent
insertAdjacentElement() Inserts a HTML element at the specified position relative to the current element Element
insertAdjacentHTML() Inserts a HTML formatted text at the specified position relative to the current element Element
insertAdjacentText() Inserts text into the specified position relative to the current element Element
insertBefore() Inserts a new child node before a specified, existing, child node Element
instanceof Returns true if the specified object is an instance of the specified object Operators
isArray() Checks whether an object is an array Array
isComposing Returns whether the state of the event is composing or not InputEvent, KeyboardEvent
isContentEditable Returns true if the content of an element is editable, otherwise false Element
isDefaultNamespace() Returns true if a specified namespaceURI is the default, otherwise false Element
isEqualNode() Checks if two elements are equal Element
isFinite() Determines whether a value is a finite, legal number Global, Number
isId Returns true if the attribute is of type Id, otherwise it returns false Attribute
isInteger() Checks whether a value is an integer Number
isNaN() Determines whether a value is an illegal number Global, Number
isSafeInteger() Checks whether a value is a safe integer Number
isSameNode() Checks if two elements are the same node Element
isSupported() Returns true if a specified feature is supported on the element Element
isTrusted Returns whether or not an event is trusted Event
item() Returns the attribute node at a specified index in a NamedNodeMap Attribute, HTMLCollection
join() Joins all elements of an array into a string Array
key Returns the key value of the key represented by the event KeyboardEvent, StorageEvent
key() Returns the name of the nth key in the storage Storage
keyCode Returns 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 event KeyboardEvent
keys() Returns a Array Iteration Object, containing the keys of the original array Array
lang Sets or returns the value of the lang attribute of an element Element
language Returns the language of the browser Navigator
lastChild Returns the last child node of an element Element
lastElementChild Returns the last child element of an element Element
lastIndex Specifies the index at which to start the next match RegExp
lastIndexOf() Search the array for an element, starting at the end, and returns its position Array, String
lastModified Returns the date and time the document was last modified Document
length Sets or returns the number of elements in an array Array, Attribute, History, HTMLCollection, Window, Storage
lengthComputable Returns whether the length of the progress can be computable or not ProgressEvent
let Declares a variable inside brackets {} scope Statements
links Returns a collection of all <a> and <area> elements in the document that have a href attribute Document
LN2 Returns the natural logarithm of 2 (approx. 0.693) Math
LN10 Returns the natural logarithm of 10 (approx. 2.302) Math
loaded Returns how much work has been loaded ProgressEvent
localeCompare() Compares two strings in the current locale String
localStorage Allows to save key/value pairs in a web browser. Stores the data with no expiration date Window
location Returns the location of a key on the keyboard or device KeyboardEvent
location Returns the Location object for the window (See Location object) Window
log() Returns the natural logarithm of a number Math, Console
log10() Returns the base-10 logarithm of a number Math
log1p() Returns the natural logarithm of 1 + a number Math
log2() Returns the base-2 logarithm of a number Math
LOG2E Returns the base-2 logarithm of E (approx. 1.442) Math
LOG10E Returns 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 element Array
match() Searches a string for a match against a regular expression, and returns the matches String
matches() Returns a Boolean value indicating whether an element is matched by a specific CSS selector or not Element
matchMedia() Returns a MediaQueryList object representing the specified CSS media query string Window
max() Returns the number with the highest value Math
MAX_VALUE Returns the largest number possible in JavaScript Number
message Sets or returns an error message (a string) Error
metaKey Returns whether the "META" key was pressed when an event was triggered MouseEvent, KeyboardEvent, TouchEvent
min() Returns the number with the lowest value Math
multiline Checks whether the "m" modifier is set RegExp
MIN_VALUE Returns the smallest number possible in JavaScript Number
moveBy() Moves a window relative to its current position Window
moveTo() Moves a window to the specified position Window
MovementX Returns the horizontal coordinate of the mouse pointer relative to the position of the last mousemove event MouseEvent
MovementY Returns the vertical coordinate of the mouse pointer relative to the position of the last mousemove event MouseEvent
name Sets or returns an error name Error, Attribute, Window
namedItem() Returns the element with the specified ID, or name, in an HTMLCollection HTMLCollection
namespaceURI Returns the namespace URI of an element Element
NaN "Not-a-Number" value Global, Number
navigator Returns the Navigator object for the window (See Navigator object) Window
NEGATIVE_INFINITY Represents negative infinity (returned on overflow) Number
new Creates an instance of a constructor
newURL Returns the URL of the document, after the hash has been changed HasChangeEvent
newValue Returns the new value of the changed storage item StorageEvent
nextSibling Returns the next node at the same node tree level Element
nextElementSibling Returns the next element at the same node tree level Element
nodeName Returns the name of a node Element
nodeType Returns the node type of a node Element
nodeValue Sets or returns the value of a node Element
normalize() Removes empty Text nodes, and joins adjacent nodes Document, Element
normalizeDocument() Removes empty Text nodes, and joins adjacent nodes Document
now() Returns the number of milliseconds since midnight Jan 1, 1970 Date
Number() Converts an object's value to a number Global
offsetHeight Returns the height of an element, including padding, border and scrollbar Element
offsetWidth Returns the width of an element, including padding, border and scrollbar Element
offsetLeft Returns the horizontal offset position of an element Element
offsetParent Returns the offset container of an element Element
offsetTop Returns the vertical offset position of an element Element
offsetX Returns the horizontal coordinate of the mouse pointer relative to the position of the edge of the target element MouseEvent
offsetY Returns the vertical coordinate of the mouse pointer relative to the position of the edge of the target element MouseEvent
oldURL Returns the URL of the document, before the hash was changed HasChangeEvent
oldValue Returns the old value of the changed storage item StorageEvent
onabort The event occurs when the loading of a media is aborted UiEvent, Event
onafterprint The event occurs when a page has started printing, or if the print dialogue box has been closed Event
onanimationend The event occurs when a CSS animation has completed AnimationEvent
onanimationiteration The event occurs when a CSS animation is repeated AnimationEvent
onanimationstart The event occurs when a CSS animation has started AnimationEvent
onbeforeprint The event occurs when a page is about to be printed Event
onbeforeunload The event occurs before the document is about to be unloaded UiEvent, Event
onblur The event occurs when an element loses focus FocusEvent
oncanplay The event occurs when the browser can start playing the media (when it has buffered enough to begin) Event
oncanplaythrough The event occurs when the browser can play through the media without stopping for buffering Event
onchange The event occurs when the content of a form element, the selection, or the checked state have changed (for <input>, <select>, and <textarea>) Event
onclick The event occurs when the user clicks on an element MouseEvent
oncontextmenu The event occurs when the user right-clicks on an element to open a context menu MouseEvent
oncopy The event occurs when the user copies the content of an element ClipboardEvent
oncut The event occurs when the user cuts the content of an element ClipboardEvent
ondblclick The event occurs when the user double-clicks on an element MouseEvent
ondrag The event occurs when an element is being dragged DragEvent
ondragend The event occurs when the user has finished dragging an element DragEvent
ondragenter The event occurs when the dragged element enters the drop target DragEvent
ondragleave The event occurs when the dragged element leaves the drop target DragEvent
ondragover The event occurs when the dragged element is over the drop target DragEvent
ondragstart The event occurs when the user starts to drag an element DragEvent
ondrop The event occurs when the dragged element is dropped on the drop target DragEvent
ondurationchange The event occurs when the duration of the media is changed Event
onemptied The event occurs when something bad happens and the media file is suddenly unavailable (like unexpectedly disconnects)  
onended The event occurs when the media has reach the end (useful for messages like "thanks for listening") Event
onerror The event occurs when an error occurs while loading an external file ProgressEvent, UiEvent, Event
onfocus The event occurs when an element gets focus FocusEvent
onfocusin The event occurs when an element is about to get focus FocusEvent
onfocusout The event occurs when an element is about to lose focus FocusEvent
onfullscreenchange The event occurs when an element is displayed in fullscreen mode Event
onfullscreenerror The event occurs when an element can not be displayed in fullscreen mode Event
onhashchange The event occurs when there has been changes to the anchor part of a URL HashChangeEvent
oninput The event occurs when an element gets user input InputEvent, Event
oninvalid The event occurs when an element is invalid Event
onkeydown The event occurs when the user is pressing a key KeyboardEvent
onkeypress The event occurs when the user presses a key KeyboardEvent
onkeyup The event occurs when the user releases a key KeyboardEvent
onLine Determines whether the browser is online Navigator
onload The event occurs when an object has loaded UiEvent, Event
onloadeddata The event occurs when media data is loaded Event
onloadedmetadata The event occurs when meta data (like dimensions and duration) are loaded Event
onloadstart The event occurs when the browser starts looking for the specified media ProgressEvent
onmessage The event occurs when a message is received through the event source Event
onmousedown The event occurs when the user presses a mouse button over an element MouseEvent
onmouseenter The event occurs when the pointer is moved onto an element MouseEvent
onmouseleave The event occurs when the pointer is moved out of an element MouseEvent
onmousemove The event occurs when the pointer is moving while it is over an element MouseEvent
onmouseover The event occurs when the pointer is moved onto an element, or onto one of its children MouseEvent
onmouseout The event occurs when a user moves the mouse pointer out of an element, or out of one of its children MouseEvent
onmouseup The event occurs when a user releases a mouse button over an element MouseEvent
onmousewheel Deprecated. Use the wheel event instead WheelEvent
onoffline The event occurs when the browser starts to work offline Event
ononline The event occurs when the browser starts to work online Event
onopen The event occurs when a connection with the event source is opened Event
onpagehide The event occurs when the user navigates away from a webpage PageTransitionEvent
onpageshow The event occurs when the user navigates to a webpage PageTransitionEvent
onpaste The event occurs when the user pastes some content in an element ClipboardEvent
onpause The event occurs when the media is paused either by the user or programmatically Event
onplay The event occurs when the media has been started or is no longer paused Event
onplaying The event occurs when the media is playing after having been paused or stopped for buffering Event
onpopstate The event occurs when the window's history changes PopStateEvent
onprogress The event occurs when the browser is in the process of getting the media data (downloading the media) Event
onratechange The event occurs when the playing speed of the media is changed Event
onresize The event occurs when the document view is resized UiEvent, Event
onreset The event occurs when a form is reset Event
onscroll The event occurs when an element's scrollbar is being scrolled UiEvent, Event
onsearch The event occurs when the user writes something in a search field (for <input="search">) Event
onseeked The event occurs when the user is finished moving/skipping to a new position in the media Event
onseeking The event occurs when the user starts moving/skipping to a new position in the media Event
onselect The event occurs after the user selects some text (for <input> and <textarea>) UiEvent, Event
onshow The event occurs when a <menu> element is shown as a context menu Event
onstalled The event occurs when the browser is trying to get media data, but data is not available Event
onstorage The event occurs when a Web Storage area is updated StorageEvent
onsubmit The event occurs when a form is submitted Event
onsuspend The event occurs when the browser is intentionally not getting media data Event
ontimeupdate The event occurs when the playing position has changed (like when the user fast forwards to a different point in the media) Event
ontoggle The event occurs when the user opens or closes the <details> element Event
ontouchcancel The event occurs when the touch is interrupted TouchEvent
ontouchend The event occurs when a finger is removed from a touch screen TouchEvent
ontouchmove The event occurs when a finger is dragged across the screen TouchEvent
ontouchstart The event occurs when a finger is placed on a touch screen TouchEvent
ontransitionend The event occurs when a CSS transition has completed TransitionEvent
onunload The event occurs once a page has unloaded (for <body>) UiEvent, Event
onvolumechange The event occurs when the volume of the media has changed (includes setting the volume to "mute") Event
onwaiting The event occurs when the media has paused but is expected to resume (like when the media pauses to buffer more data) Event
onwheel The event occurs when the mouse wheel rolls up or down over an element WheelEvent
open() Opens an HTML output stream to collect output from document.write() Document, Window
opener Returns a reference to the window that created the window Window
origin Returns the protocol, hostname and port number of a URL Location
outerHeight Returns the height of the browser window, including toolbars/scrollbars Window
outerHTML Sets or returns the outer content of an element Element
outerText Sets or returns the text outer content of a node and its descendants Element
outerWidth Returns the width of the browser window, including toolbars/scrollbars Window
ownerDocument Returns the root element (document object) for an element Element
pageX Returns the horizontal coordinate of the mouse pointer, relative to the document, when the mouse event was triggered MouseEvent
pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window Window
pageY Returns the vertical coordinate of the mouse pointer, relative to the document, when the mouse event was triggered MouseEvent
pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window Window
parent Returns the parent window of the current window Window
parentNode Returns the parent node of an element Element
parentElement Returns the parent element node of an element Element
parse() Parses a date string and returns the number of milliseconds since January 1, 1970 Date, JSON
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 path name of a URL Location
persisted Returns whether the webpage was cached by the browser PageTransitionEvent
PI Returns PI (approx. 3.14) Math
pixelDepth Returns the color resolution (in bits per pixel) of the screen Screen
platform Returns for which platform the browser is compiled Navigator
pop() Removes the last element of an array, and returns that element Array
port Sets or returns the port number of a URL Location
position Returns the position of the concerned device at a given time Geolocation
positionError Returns the reason of an error occurring when using the geolocating device Geolocation
positionOptions Describes an object containing option properties to pass as a parameter of Geolocation.getCurrentPosition() and Geolocation.watchPosition() Geolocation
POSITIVE_INFINITY Represents 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 occur Event
print() Prints the content of the current window Window
product Returns the engine name of the browser Navigator
propertyName Returns the name of the CSS property associated with the animation or transition AnimationEvent, TransitionEvent
protocol Sets or returns the protocol of a URL Location
prototype Allows you to add properties and methods to an Array object Array, Boolean, Date
pseudoElement Returns the name of the pseudo-element of the animation or transition AnimationEvent, TransitionEvent
push() Adds new elements to the end of an array, and returns the new length Array
querySelector() Returns the first element that matches a specified CSS selector(s) in the document Document, Element
querySelectorAll() Returns a static NodeList containing all elements that matches a specified CSS selector(s) in the document Document, Element
random() Returns a random number between 0 and 1 Math
readyState Returns the (loading) status of the document Document
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
referrer Returns the URL of the document that loaded the current document Document
region MouseEvent
reload() Reloads the current document Location
remove() Removes the element from the DOM Element
removeAttribute() Removes a specified attribute from an element Element
removeAttributeNode() Removes a specified attribute node, and returns the removed node Element
removeChild() Removes a child node from an element Element
removeEventListener() Removes an event handler that has been attached with the addEventListener() method Element
removeItem() Removes that key from the storage Storage
repeat Returns whether a key is being hold down repeatedly, or not KeyboardEvent
repeat() Returns a new string with a specified number of copies of an existing string String
replace() Searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced String, Location
replaceChild() Replaces a child node in an element Element
requestAnimationFrame() Requests the browser to call a function to update an animation before the next repaint Window
requestFullscreen() Shows an element in fullscreen mode Element
resizeBy() Resizes the window by the specified pixels Window
resizeTo() Resizes the window to the specified width and height Window
return Stops the execution of a function and returns a value from that function Statements
reverse() Reverses the order of the elements in an array Array
round() Rounds x to the nearest integer Math
pow() Returns the value of x to the power of y Math
previousSibling Returns the previous node at the same node tree level Element
previousElementSibling Returns the previous element at the same node tree level Element
prompt() Displays a dialog box that prompts the visitor for input Window
prototype Allows you to add properties and methods to an object Number
relatedTarget Returns the element related to the element that triggered the mouse event MouseEvent, FocusEvent
removeEventListener() Removes an event handler from the document (that has been attached with the addEventListener() method) Document
removeNamedItem() Removes a specified attribute node Attribute
renameNode() Renames the specified node Document
screen Returns the Screen object for the window (See Screen object) Window
screenLeft Returns the horizontal coordinate of the window relative to the screen Window
screenTop Returns the vertical coordinate of the window relative to the screen Window
screenX Returns the horizontal coordinate of the window/mouse pointer relative to the screen Window, MouseEvent
screenY Returns the vertical coordinate of the window/mouse pointer relative to the screen Window, MouseEvent
scripts Returns a collection of <script> elements in the document Document
scroll() Deprecated. This method has been replaced by the scrollTo() method. Window
scrollBy() Scrolls the document by the specified number of pixels Window
scrollHeight Returns the entire height of an element, including padding Element
scrollIntoView() Scrolls the specified element into the visible area of the browser window Element
scrollLeft Sets or returns the number of pixels an element's content is scrolled horizontally Element
scrollTo() Scrolls the document to the specified coordinates Window
scrollTop Sets or returns the number of pixels an element's content is scrolled vertically Element
scrollWidth Returns the entire width of an element, including padding Element
scrollX An alias of pageXOffset Window
scrollY An alias of pageYOffset Window
search Sets or returns the querystring part of a URL Location
search() Searches a string for a specified value, or regular expression, and returns the position of the match String
self Returns the current window Window
sessionStorage Allows to save key/value pairs in a web browser. Stores the data for one session Window
setAttribute() Sets or changes the specified attribute, to the specified value Element
setAttributeNode() Sets or changes the specified attribute node Element
setDate() Sets the day of the month of a date object Date
setFullYear() Sets the year of a date object Date
setHours() Sets the hour of a date object Date
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 exists Storage
setMilliseconds() Sets the milliseconds of a date object Date
setMinutes() Set the minutes of a date object Date
setMonth() Sets the month of a date object Date
setNamedItem() Sets the specified attribute node (by name) Attribute
setSeconds() Sets the seconds of a date object Date
setTime() Sets a date to a specified number of milliseconds after/before January 1, 1970 Date
setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds Window
setUTCDate() Sets the day of the month of a date object, according to universal time Date
setUTCFullYear() Sets the year of a date object, according to universal time Date
setUTCHours() Sets the hour of a date object, according to universal time Date
setUTCMilliseconds() Sets the milliseconds of a date object, according to universal time Date
setUTCMinutes() Set the minutes of a date object, according to universal time Date
setUTCMonth() Sets the month of a date object, according to universal time Date
setUTCSeconds() Set the seconds of a date object, according to universal time Date
setYear() Deprecated. Use the setFullYear() method instead Date
shift() Removes the first element of an array, and returns that element Array
shiftKey Returns whether the "SHIFT" key was pressed when an event was triggered MouseEvent, 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 x Math
slice() Selects a part of an array, and returns the new array Array, String
some() Checks if any of the elements in an array pass a test Array
sort() Sorts the elements of an array Array
source Returns the text of the RegExp pattern RegExp
specified Returns true if the attribute has been specified, otherwise it returns false Attribute
splice() Adds/Removes elements from an array Array
split() Splits a string into an array of substrings String
static Defines a static method for a class Classes
startsWith() Checks whether a string begins with specified characters String
state Returns an object containing a copy of the history entries PopStateEvent
String() Converts an object's value to a string Global
stop() Stops the window from loading Window
stopImmediatePropagation() Prevents other listeners of the same event from being called Event
stopPropagation() Prevents further propagation of an event during event flow Event
stringify() Convert a JavaScript object to a JSON string JSON
sqrt() Returns the square root of x Math
SQRT1_2 Returns the square root of 1/2 (approx. 0.707) Math
SQRT2 Returns the square root of 2 (approx. 1.414) Math
status Sets or returns the text in the statusbar of a window Window
strictErrorChecking Sets or returns whether error-checking is enforced or not Document
storageArea Returns an object representing the affected storage object StorageEvent
style Sets or returns the value of the style attribute of an element Element
substr() Extracts the characters from a string, beginning at a specified start position, and through the specified number of character String
substring() Extracts the characters from a string, between two specified indices String
super Refers to the parent class Classes
switch Marks a block of statements to be executed depending on different cases Statements
table() Displays tabular data as a table Console
tabIndex Sets or returns the value of the tabindex attribute of an element Element
tagName Returns the tag name of an element Element
tan() Returns the tangent of an angle Math
tanh() Returns the hyperbolic tangent of a number Math
target Returns the element that triggered the event Event
targetTouches Returns 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 element TouchEvent
test() Tests for a match in a string. Returns true or false RegExp
textContent Sets or returns the textual content of a node and its descendants Element
this Refers to the object it belongs to
throw Throws (generates) an error Statements
time() Starts a timer (can track how long an operation takes) Console
timeEnd() Stops a timer that was previously started by console.time() Console
timeStamp Returns the time (in milliseconds relative to the epoch) at which the event was created Event
title Sets or returns the title of the document Document, Element
toDateString() Converts the date portion of a Date object into a readable string Date
toGMTString() Deprecated. Use the toUTCString() method instead Date
toExponential() Converts a number into an exponential notation Number
toFixed(x) Formats a number with x numbers of digits after the decimal point Number
toJSON() Returns the date as a string, formatted as a JSON date Date
toISOString() Returns the date as a string, using the ISO standard Date
toLocaleDateString() Returns the date portion of a Date object as a string, using locale conventions Date
toLocaleLowerCase() Converts a string to lowercase letters, according to the host's locale String
toLocaleString() Converts a Date object to a string, using locale conventions Date
toLocaleTimeString() Returns the time portion of a Date object as a string, using locale conventions Date
toLocaleUpperCase() Converts a string to uppercase letters, according to the host's locale String
toLowerCase() Converts a string to lowercase letters String
top Returns the topmost browser window Window
toPrecision(x) Formats a number to x length Number
toString() Converts an array to a string, and returns the result Array, Boolean, Date, Number, RegExp, String, Element
total Returns the total amount of work that will be loaded ProgressEvent
toTimeString() Converts the time portion of a Date object to a string Date
touches Returns a list of all the touch objects that are currently in contact with the surface TouchEvent
toUpperCase() Converts a string to uppercase letters String
toUTCString() Converts a Date object to a string, according to universal time Date
trace() Outputs a stack trace to the console Console
transitionend The event occurs when a CSS transition has completed TransitionEvent
trim() Removes whitespace from both ends of a string String
trunc() Returns the integer part of a number (x) Math
try ... catch ... finally Marks the 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() Deprecated in version 1.5. Use decodeURI() or decodeURIComponent() instead Global
unshift() Adds new elements to the beginning of an array, and returns the new length Array
url Returns the URL of the changed item's document StorageEvent
URL Returns the full URL of the HTML document Document
userAgent Returns the user-agent header sent by the browser to the server Navigator
UTC() Returns the number of milliseconds in a date since midnight of January 1, 1970, according to UTC time Date
value Sets or returns the value of the attribute Attribute
valueOf() Returns the primitive value of an array Array, Boolean, Date, Number, String
var Declares a variable Statements
warn() Outputs a warning message to the console Console
watchPosition() Returns a watch ID value that then can be used to unregister the handler by passing it to the Geolocation.clearWatch() method Geolocation
which Returns which mouse button was pressed when the mouse event was triggered MouseEvent, KeyboardEvent
width Returns the total width of the screen Screen
view Returns a reference to the Window object where the event occurred UiEvent
void Evaluates an expression and returns undefined Operators
while Marks a block of statements to be executed while a condition is true Statements
write() Writes HTML expressions or JavaScript code to a document Document
writeln() Same as write(), but adds a newline character after each statement Document
yield Pauses and resumes a generator function Operators

JavaScript 教程

访问我们的 JavaScript 教程 »