菜单
×
   ❮     
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> 按钮 <input> 复选框 <input> 颜色 <input> 日期 <input> 日期时间 <input> 日期时间-本地 <input> 邮箱 <input> 文件 <input> 隐藏 <input> 图片 <input> 月份 <input> 数字 <input> 密码 <input> 单选 <input> 范围 <input> 重置 <input> 搜索 <input> 提交 <input> 文本 <input> 时间 <input> URL <input> 周 <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 事件属性


HTML DOM 事件允许 JavaScript 在 HTML 文档中的元素上注册不同的事件处理程序。

事件通常与函数结合使用,函数在事件发生之前不会执行(例如当用户点击按钮时)。

有关事件的教程,请阅读我们的 JavaScript 事件教程


HTML DOM 事件属性

属性 描述 所属
altKey 当鼠标事件触发时,返回是否按下“ALT”键 MouseEvent
altKey 当键盘事件触发时,返回是否按下“ALT”键 KeyboardEvent, TouchEvent
animationName 返回动画的名称 AnimationEvent
bubbles 返回特定事件是否是冒泡事件 事件
button 当鼠标事件触发时,返回按下了哪个鼠标按钮 MouseEvent
buttons 当鼠标事件触发时,返回按下了哪些鼠标按钮 MouseEvent
cancelable 返回事件是否可以阻止其默认操作 事件
charCode 已弃用(避免使用)
请改用key 属性
KeyboardEvent
changeTouches 返回所有触摸对象的列表,这些触摸对象的状态在上次触摸和本次触摸之间发生了变化 TouchEvent
clientX 当鼠标事件触发时,返回鼠标指针相对于当前窗口的水平坐标 MouseEvent, TouchEvent
clientY 当鼠标事件触发时,返回鼠标指针相对于当前窗口的垂直坐标 MouseEvent, TouchEvent
clipboardData 返回一个对象,其中包含受剪贴板操作影响的数据 ClipboardData
代码 返回触发事件的键的代码 KeyboardEvent
composed 返回事件是否合成 事件
ctrlKey 当鼠标事件触发时,返回是否按下“CTRL”键 MouseEvent
ctrlKey 当键盘事件触发时,返回是否按下“CTRL”键 KeyboardEvent, TouchEvent
currentTarget 返回其事件监听器触发事件的元素 事件
data 返回插入的字符 InputEvent
dataTransfer 返回一个对象,其中包含正在拖放、插入或删除的数据 DragEvent, InputEvent
defaultPrevented 返回是否为该事件调用了 preventDefault() 方法 事件
deltaX 返回鼠标滚轮的水平滚动量(x 轴) WheelEvent
deltaY 返回鼠标滚轮的垂直滚动量(y 轴) WheelEvent
deltaZ 返回鼠标滚轮在 z 轴上的滚动量 WheelEvent
deltaMode 返回一个数字,表示 delta 值的测量单位(像素、行或页) WheelEvent
detail 返回一个数字,表示鼠标点击的次数 UiEvent
elapsedTime 返回动画已运行的秒数 AnimationEvent
elapsedTime 返回过渡已运行的秒数  
eventPhase 返回当前正在评估的事件流阶段 事件
getModifierState() 返回一个数组,其中包含将受插入/删除影响的目标范围 MouseEvent
inputType 返回更改的类型(即“插入”或“删除”) InputEvent
isComposing 返回事件的状态是否正在组合 InputEvent, KeyboardEvent
isTrusted 返回事件是否受信任 事件
key 返回事件所表示的键的键值 KeyboardEvent
key 返回已更改的存储项的键 StorageEvent
keyCode 已弃用(避免使用)
请改用key 属性
KeyboardEvent
location 返回键盘或设备上键的位置 KeyboardEvent
lengthComputable 返回进度的长度是否可计算 ProgressEvent
loaded 返回已加载的工作量 ProgressEvent
metaKey 当事件触发时,返回是否按下“META”键 MouseEvent
metaKey 当键盘事件触发时,返回是否按下“meta”键 KeyboardEvent, TouchEvent
MovementX 返回鼠标指针相对于上次 mousemove 事件位置的水平坐标 MouseEvent
MovementY 返回鼠标指针相对于上次 mousemove 事件位置的垂直坐标 MouseEvent
newValue 返回已更改的存储项的新值 StorageEvent
newURL 返回哈希更改后文档的 URL HasChangeEvent
offsetX 返回鼠标指针相对于目标元素边缘位置的水平坐标 MouseEvent
offsetY 返回鼠标指针相对于目标元素边缘位置的垂直坐标 MouseEvent
oldValue 返回已更改的存储项的旧值 StorageEvent
oldURL 返回哈希更改前文档的 URL HasChangeEvent
onemptied 当发生意外情况且媒体文件突然不可用时(例如意外断开连接)  
pageX 当鼠标事件触发时,返回鼠标指针相对于文档的水平坐标 MouseEvent
pageY 当鼠标事件触发时,返回鼠标指针相对于文档的垂直坐标 MouseEvent
persisted 返回网页是否被浏览器缓存 PageTransitionEvent
propertyName 返回与动画或过渡关联的 CSS 属性的名称 AnimationEvent, TransitionEvent
pseudoElement 返回动画或过渡的伪元素的名称 AnimationEvent, TransitionEvent
region MouseEvent
relatedTarget 返回与触发鼠标事件的元素相关的元素 MouseEvent
relatedTarget 返回与触发事件的元素相关的元素 FocusEvent
重复 返回键是否被重复按住 KeyboardEvent
screenX 当事件触发时,返回鼠标指针相对于屏幕的水平坐标 MouseEvent
screenY 当事件触发时,返回鼠标指针相对于屏幕的垂直坐标 MouseEvent
shiftKey 当事件触发时,返回是否按下“SHIFT”键 MouseEvent
shiftKey 当键盘事件触发时,返回是否按下“SHIFT”键 KeyboardEvent, TouchEvent
state 返回一个包含历史记录条目副本的对象 PopStateEvent
storageArea 返回一个表示受影响的存储对象 StorageEvent
target 返回触发事件的元素 事件
targetTouches 返回所有触摸对象的列表,这些触摸对象与表面接触,并且 touchstart 事件发生在与当前目标元素相同的目标元素上 TouchEvent
timeStamp 返回事件创建时的时间(相对于纪元的毫秒数) 事件
total 返回将加载的总工作量 ProgressEvent
touches 返回所有当前与表面接触的触摸对象的列表 TouchEvent
transitionend CSS 过渡已完成 TransitionEvent
type 返回事件的名称 事件
url 返回已更改项的文档的 URL StorageEvent
which 已弃用(避免使用)
请改用button 属性
MouseEvent
which 已弃用(避免使用)
请改用key 属性
KeyboardEvent
view 返回事件发生的 Window 对象的引用 UiEvent
x clientX 的别名 MouseEvent
y clientY 的别名 MouseEvent
×

联系销售

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

报告错误

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

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

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