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 Document 对象

Document 对象

每个载入浏览器的 HTML 文档都会成为 Document 对象。

Document 对象使我们可以从脚本中对 HTML 页面中的所有元素进行访问。

提示:Document 对象是 Window 对象的一部分,可通过 window.document 属性对其进行访问。


Document 对象属性和方法

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

属性 / 方法 描述
activeElement 返回当前获取焦点元素
addEventListener() 向文档添加句柄
adoptNode() 从另外一个文档返回 adapded 节点到当前文档。
anchors 返回文档中具有 name 属性的所有 <a> 元素的集合
applets 返回对文档中所有 Applet 对象的引用。
baseURI 返回文档的绝对基 URI
body 返回文档的 body 元素
close() 关闭用 document.open() 方法打开的输出流,并显示选定的数据。
cookie 设置或返回与当前文档有关的所有 cookie。
charset 已弃用。 请改用 characterSet。 返回文档的字符编码
characterSet 返回文档的字符编码
createAttribute() 创建一个属性节点
createComment() 创建注释节点
createDocumentFragment() 创建空的 DocumentFragment 对象,并返回此对象。
createElement() 创建元素节点。
createEvent() 创建新的事件。
createTextNode() 创建文本节点。
defaultView 返回与文档关联的窗口对象,如果没有可用的窗口对象,则返回 null。
designMode 控制整个文档是否应可编辑。
doctype 返回与文档相关的文档类型声明 (DTD)。
documentElement 返回文档的 Document 元素 (the <html> 元素)
documentMode 返回用于通过浏览器渲染文档的模式
documentURI 设置或返回文档的位置
domain 返回当前文档的域名。
domConfig 已废弃。 返回 normalizeDocument() 被调用时所使用的配置。
embeds 返回文档中所有 <embed> 元素的集合
execCommand() 对当前具有焦点的元素调用指定的剪贴板操作。
forms 返回文档中所有 <form> 元素的集合。
fullscreenElement 返回以全屏模式显示的当前元素
fullscreenEnabled() 返回一个布尔值,指示是否可以全屏模式查看文档
getElementById() 返回对拥有指定 id 的第一个对象的引用。
getElementsByClassName() 返回文档中所有指定类名的元素集合,作为 NodeList 对象。
getElementsByName() 返回带有指定名称的对象集合。
getElementsByTagName() 返回带有指定标签名的对象集合。
hasFocus() 返回一个布尔值,指示文档是否具有焦点
head 返回文档的 <head> 元素
images 返回文档中所有 <img> 元素的集合
implementation 返回处理该文档的 DOMImplementation 对象。
importNode() 从另一个文档导入节点
inputEncoding 返回用于文档的编码字符集
lastModified 返回文档被最后修改的日期和时间。
links 返回文档中具有 href 属性的所有 <a> 和 <area> 元素的集合
normalize() 删除空文本节点,并连接相邻节点
normalizeDocument() 删除空文本节点,并连接相邻节点
open() 打开一个流,以收集来自任何 document.write() 或 document.writeln() 方法的输出。
querySelector() 返回文档中匹配指定的 CSS 选择器的第一元素
querySelectorAll() 返回文档中匹配的CSS选择器的所有元素节点列表
readyState 返回文档状态 (加载中……)
referrer 返回载入当前文档的文档的 URL。
removeEventListener() 移除文档中的事件句柄 (由 addEventListener() 方法添加)
renameNode() 重命名元素或者属性节点。
scripts 返回页面中所有 <script> 脚本的集合。
strictErrorChecking 设置或返回是否强制进行错误检查。
title 返回当前文档的标题。
URL 返回当前文档的 URL。
write() 向文档写 HTML 表达式 或 JavaScript 代码。
writeln() 等同于 write() 方法,不同的是在每个表达式之后写一个换行符。