JS 参考手册

JS 参考手册(类别排序) JS 参考手册(字母排序)

JavaScript

JS Array JS Boolean JS Classes JS Date JS Error JS Global JS JSON JS Math JS Number JS 运算符 JS RegExp JS 语句 JS String

HTML DOM

DOM Attributes DOM Document DOM Element DOM Events DOM Event 对象 DOM HTMLCollection DOM Location DOM Navigator DOM Screen DOM Style
alignContent alignItems alignSelf animation animationDelay animationDirection animationDuration animationFillMode animationIterationCount animationName animationTimingFunction animationPlayState background backgroundAttachment backgroundColor backgroundImage backgroundPosition backgroundRepeat backgroundClip backgroundOrigin backgroundSize backfaceVisibility border borderBottom borderBottomColor borderBottomLeftRadius borderBottomRightRadius borderBottomStyle borderBottomWidth borderCollapse borderColor borderImage borderImageOutset borderImageRepeat borderImageSlice borderImageSource borderImageWidth borderLeft borderLeftColor borderLeftStyle borderLeftWidth borderRadius borderRight borderRightColor borderRightStyle borderRightWidth borderSpacing borderStyle borderTop borderTopColor borderTopLeftRadius borderTopRightRadius borderTopStyle borderTopWidth borderWidth bottom boxShadow boxSizing captionSide caretColor clear clip color columnCount columnFill columnGap columnRule columnRuleColor columnRuleStyle columnRuleWidth columns columnSpan columnWidth counterIncrement counterReset cursor direction display emptyCells filter flex flexBasis flexDirection flexFlow flexGrow flexShrink flexWrap cssFloat font fontFamily fontSize fontStyle fontVariant fontWeight fontSizeAdjust height isolation justifyContent left letterSpacing lineHeight listStyle listStyleImage listStylePosition listStyleType margin marginBottom marginLeft marginRight marginTop maxHeight maxWidth minHeight minWidth objectFit objectPosition opacity order orphans outline outlineColor outlineOffset outlineStyle outlineWidth overflow overflowX overflowY padding paddingBottom paddingLeft paddingRight paddingTop pageBreakAfter pageBreakBefore pageBreakInside perspective perspectiveOrigin position quotes resize right scrollBehavior tableLayout tabSize textAlign textAlignLast textDecoration textDecorationColor textDecorationLine textDecorationStyle textIndent textOverflow textShadow textTransform top transform transformOrigin transformStyle transition transitionProperty transitionDuration transitionTimingFunction transitionDelay unicodeBidi userSelect verticalAlign visibility width wordBreak wordSpacing wordWrap widows zIndex
DOM Window

Web APIs

API Console API Geolocation API History API Storage

HTML 对象

<a> <abbr> <address> <area> <article> <aside> <audio> <b> <base> <bdo> <blockquote> <body> <br> <button> <canvas> <caption> <cite> <code> <col> <colgroup> <datalist> <dd> <del> <details> <dfn> <dialog> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <footer> <form> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <ins> <input> button <input> checkbox <input> color <input> date <input> datetime <input> datetime-local <input> email <input> file <input> hidden <input> image <input> month <input> number <input> password <input> radio <input> range <input> reset <input> search <input> submit <input> text <input> time <input> url <input> week <kbd> <label> <legend> <li> <link> <map> <mark> <menu> <menuitem> <meta> <meter> <nav> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <s> <samp> <script> <section> <select> <small> <source> <span> <strong> <style> <sub> <summary> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <tr> <textarea> <time> <title> <track> <u> <ul> <var> <video>

其他参考手册

CSSStyleDeclaration JS 类型转换



HTML DOM Element 对象

Element 对象

在 HTML DOM 中,Element 对象表示 HTML 元素。类似于P、DIV、A、TABLE 或任何其他 HTML 元素。

Element 对象可以拥有类型为元素节点、文本节点、注释节点的子节点。


属性和方法

下面的属性和方法可用于所有 HTML 元素上:

属性 / 方法 描述
accessKey 设置或返回元素的快捷键。
addEventListener() 向指定元素添加事件句柄
appendChild() 向元素添加新的子节点,作为最后一个子节点。
attributes 返回元素属性的 NamedNodeMap。
blur() 从元素中移除焦点
childElementCount 返回元素包含的子元素数
childNodes 返回元素子节点的 NodeList。
children 返回元素的子元素的集合(不包括文本和注释节点)
classList 返回元素的类名
className 设置或返回元素的 class 属性。
click() 模拟在元素上单击鼠标
clientHeight 在页面上返回内容的可视高度(高度包含内边距(padding),不包含边框(border),外边距(margin)和滚动条)
clientLeft 返回一个元素的左边框的宽度,以像素表示。
clientTop 返回一个元素的顶部边框的宽度,以像素表示。
clientWidth 返回元素的可见宽度。
cloneNode() 克隆元素。
closest() 在 DOM 树上搜索与指定 CSS 选择器匹配的最近元素
compareDocumentPosition() 比较两个元素的文档位置。
contains() 如果节点是节点的后代,则返回 true,否则返回 false
contentEditable 设置或返回元素的文本方向。
dir 设置或返回元素的内容是否可编辑。
exitFullscreen() 在全屏模式下取消元素
firstChild 返回元素的首个子。
firstElementChild 返回元素的第一个子元素
focus() 设置文档或元素获取焦点
getAttribute() 返回元素节点的指定属性值。
getAttributeNode() 返回指定的属性节点。
getBoundingClientRect() 返回元素的大小及其相对于视口的位置
getElementsByClassName() 返回文档中所有指定类名的元素集合,作为 NodeList 对象。
getElementsByTagName() 返回拥有指定标签名的所有子元素的集合。
hasAttribute() 如果元素拥有指定属性,则返回true,否则返回 false。
hasAttributes() 如果元素拥有属性,则返回 true,否则返回 false。
hasChildNodes() 如果元素拥有子节点,则返回 true,否则 false。
id 设置或返回元素的 id。
innerHTML 设置或返回元素的内容。
innerText 设置或返回节点及其子节点的文本内容
insertAdjacentElement() 在相对于当前元素的指定位置插入 HTML 元素
insertAdjacentHTML() 在相对于当前元素的指定位置插入 HTML 格式的文本
insertAdjacentText() 将文本插入到相对于当前元素的指定位置
insertBefore() 在指定的已有的子节点之前插入新节点。
isContentEditable 设置或返回元素的内容。
isDefaultNamespace() 如果指定的 namespaceURI 是默认的,则返回 true,否则返回 false。
isEqualNode() 检查两个元素是否相等。
isSameNode() 检查两个元素是否是相同的节点。
isSupported() 如果元素支持指定特性,则返回 true。
lang 设置或返回元素的语言代码。
lastChild 返回元素的最后一个子元素。
lastElementChild 返回指定元素的最后一个子元素
matches() 如果元素匹配指定的 CSS 选择器,matches() 方法就返回 true,否则返回 false。
namespaceURI 返回元素的 namespace URI。
nextSibling 返回位于相同节点树层级的下一个节点。
nextElementSibling 返回指定元素之后的下一个兄弟元素(相同节点树层中的下一个元素节点)。
nodeName 返回元素的名称。
nodeType 返回元素的节点类型。
nodeValue 设置或返回元素值。
normalize() 合并元素中相邻的文本节点,并移除空的文本节点。
offsetHeight 返回元素的高度。
offsetWidth 返回元素的宽度。
offsetLeft 返回元素的水平偏移位置。
offsetParent 返回元素的偏移容器。
offsetTop 返回元素的垂直偏移位置。
outerHTML 设置或返回元素的内容(包括开始标记和结束标记)
outerText 设置或返回节点及其子节点的外部文本内容
ownerDocument 返回元素的根元素(文档对象)。
parentNode 返回元素的父节点。
parentElement 返回元素的父元素节点
previousSibling 返回位于相同节点树层级的前一个元素。
previousElementSibling 返回指定元素的前一个兄弟元素(相同节点树层中的前一个元素节点)。
querySelector() 返回匹配指定 CSS 选择器元素的第一个子元素
querySelectorAll() 返回匹配指定 CSS 选择器元素的所有子元素节点列表
remove() 从 DOM 中删除元素
removeAttribute() 从元素中移除指定属性。
removeAttributeNode() 移除指定的属性节点,并返回被移除的节点。
removeChild() 从元素中移除子节点。
removeEventListener() 移除由 addEventListener() 方法添加的事件句柄
replaceChild() 替换元素中的子节点。
requestFullscreen() 以全屏模式显示元素
scrollHeight 返回元素的整体高度。
scrollIntoView() 将指定的元素滚动到浏览器窗口的可见区域
scrollLeft 返回元素左边缘与视图之间的距离。
scrollTop 返回元素上边缘与视图之间的距离。
scrollWidth 返回元素的整体宽度。
setAttribute() 把指定属性设置或更改为指定值。
setAttributeNode() 设置或更改指定属性节点。
style 设置或返回元素的 style 属性。
tabIndex 设置或返回元素的 tab 键控制次序。
tagName 返回元素的标签名。
textContent 设置或返回节点及其后代的文本内容。
title 设置或返回元素的 title 属性。
toString() 把元素转换为字符串。