菜单
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

JS 参考手册

按类别划分的 JS 按字母划分的 JS

JavaScript

JS 数组 JS 布尔值 JS 类 JS 日期 JS 错误 JS 全局 JS JSON JS Map JS Math JS 数字 JS 对象 JS 运算符 JS 优先级 JS Promise JS 正则表达式 JS Set JS 语句 JS 字符串 JS TypedArray

Window

Window 对象 Window Console Window History Window Location Window Navigator Window Screen

HTML DOM

HTML 文档 HTML 元素 HTML 属性 HTML 集合 HTML NodeList HTML DOMTokenList HTML 样式
alignContent alignItems alignSelf animation animationDelay animationDirection animationDuration animationFillMode animationIterationCount animationName animationTimingFunction animationPlayState background backgroundAttachment backgroundClip backgroundColor backgroundImage backgroundOrigin backgroundPosition backgroundRepeat 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 cssFloat cursor direction display emptyCells filter flex flexBasis flexDirection flexFlow flexGrow flexShrink flexWrap 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

HTML 事件

HTML 事件 HTML 事件对象 HTML 事件属性 HTML 事件方法

Web API

API Canvas API Console API Fetch API Fullscreen API 地理位置 API History API MediaQueryList API Storage API 验证 API Web

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 转换


Window 对象


Window 对象

window 对象代表浏览器中的一个打开的窗口。

如果文档包含框架(<iframe> 标签),浏览器会为 HTML 文档创建一个 window 对象,并为每个框架创建一个额外的 window 对象。


Window 对象属性

属性 描述
closed 如果窗口已关闭,返回布尔值 true。
console 返回窗口的 Console 对象。
另请参阅 Console 对象
defaultStatus 已废弃。
document 返回窗口的 Document 对象。
另请参阅 Document 对象
frameElement 返回窗口运行所在的框架。
frames 返回窗口中运行的所有 window 对象。
历史 返回窗口的 History 对象。
另请参阅 History 对象
innerHeight 返回窗口内容区域(视口)的高度,包括滚动条。
innerWidth 返回窗口内容区域(视口)的宽度,包括滚动条。
length 返回当前窗口中的 <iframe> 元素的数量。
localStorage 允许在 Web 浏览器中保存键/值对。数据存储没有过期日期
location 返回窗口的 Location 对象。
另请参阅 Location 对象
name 设置或返回窗口的名称。
navigator 返回窗口的 Navigator 对象。
另请参阅 Navigator 对象
opener 返回创建该窗口的窗口的引用。
outerHeight 返回浏览器窗口的高度,包括工具栏/滚动条。
outerWidth 返回浏览器窗口的宽度,包括工具栏/滚动条。
pageXOffset 返回当前文档从窗口左上角水平滚动过的像素数。
pageYOffset 返回当前文档从窗口左上角垂直滚动过的像素数。
parent 返回当前窗口的父窗口。
screen 返回窗口的 Screen 对象。
另请参阅 Screen 对象
screenLeft 返回窗口相对于屏幕的水平坐标。
screenTop 返回窗口相对于屏幕的垂直坐标。
screenX 返回窗口相对于屏幕的水平坐标。
screenY 返回窗口相对于屏幕的垂直坐标。
sessionStorage 允许在 Web 浏览器中保存键/值对。数据存储在一个会话中
scrollX pageXOffset 的别名。
scrollY pageYOffset 的别名。
self 返回当前窗口。
status 已废弃。避免使用。
top 返回最顶层的浏览器窗口。


Window 对象方法

方法 描述
addEventListener() 将事件处理程序附加到窗口。
alert() 显示一个带消息和“确定”按钮的警告框。
atob() 解码 base-64 编码的字符串。
blur() 从当前窗口移除焦点。
btoa() 将字符串编码为 base-64。
clearInterval() 清除由 setInterval() 设置的计时器。
clearTimeout() 清除由 setTimeout() 设置的计时器。
close() 关闭当前窗口。
confirm() 显示一个带消息、“确定”和“取消”按钮的对话框。
focus() 设置焦点到当前窗口。
getComputedStyle() 获取应用于元素的当前计算出的 CSS 样式。
getSelection() 返回一个 Selection 对象,表示用户选择的文本范围。
matchMedia() 返回一个 MediaQueryList 对象,表示指定的 CSS 媒体查询字符串。
moveBy() 相对于当前位置移动窗口。
moveTo() 将窗口移动到指定位置。
open() 打开一个新的浏览器窗口。
print() 打印当前窗口的内容。
prompt() 显示一个对话框,提示访问者输入。
removeEventListener() 从窗口中移除事件处理程序。
requestAnimationFrame() 请求浏览器在下一次重绘之前调用一个函数来更新动画。
resizeBy() 按指定的像素调整窗口大小。
resizeTo() 将窗口调整为指定的宽度和高度。
scroll() 已废弃。
请改用 scrollTo()
scrollBy() 按指定的像素数滚动文档。
scrollTo() 将文档滚动到指定的坐标。
setInterval() 以指定的时间间隔(毫秒)调用函数或评估表达式。
setTimeout() 在指定的毫秒数后调用函数或评估表达式。
stop() 停止窗口加载。

×

联系销售

如果您想将 W3Schools 服务用于教育机构、团队或企业,请发送电子邮件给我们
sales@w3schools.com

报告错误

如果您想报告错误,或想提出建议,请发送电子邮件给我们
help@w3schools.com

W3Schools 经过优化,旨在方便学习和培训。示例可能经过简化,以提高阅读和学习体验。教程、参考资料和示例会不断审查,以避免错误,但我们无法保证所有内容的完全正确性。使用 W3Schools 即表示您已阅读并接受我们的使用条款Cookie 和隐私政策

版权所有 1999-2024 Refsnes Data。保留所有权利。W3Schools 由 W3.CSS 提供支持