HTML5全局属性和事件
属性 | 描述 |
---|---|
contenteditable | 规定是否允许用户编辑内容。 |
contextmenu | 规定元素的上下文菜单。 |
draggable | 规定是否允许用户拖动元素。 |
dropzone | 规定当被拖动的项目/数据被拖放到元素中时会发生什么。 |
hidden | 规定该元素是无关的。被隐藏的元素不会显示。 |
spellcheck | 规定是否必须对元素进行拼写或语法检查。 |
属性 | 值 | 描述 |
---|---|---|
onafterprint | script | 文档打印之后运行的脚本。 |
onbeforeprint | script | 文档打印之前运行的脚本。 |
onbeforeunload | script | 文档卸载之前运行的脚本。 |
onerror | script | 在错误发生时运行的脚本。 |
onhaschange | script | 当文档已改变时运行的脚本。 |
onmessage | script | 在消息被触发时运行的脚本。 |
onoffline | script | 当文档离线时运行的脚本。 |
ononline | script | 当文档上线时运行的脚本。 |
onpagehide | script | 当窗口隐藏时运行的脚本。 |
onpageshow | script | 当窗口成为可见时运行的脚本。 |
onpopstate | script | 当窗口历史记录改变时运行的脚本。 |
onredo | script | 当文档执行撤销(redo)时运行的脚本。 |
onresize | script | 当浏览器窗口被调整大小时触发。 |
onstorage | script | 在 Web Storage 区域更新后运行的脚本。 |
onundo | script | 在文档执行 undo 时运行的脚本。 |
属性 | 值 | 描述 |
---|---|---|
oncontextmenu | script | 当上下文菜单被触发时运行的脚本。 |
onformchange | script | 在表单改变时运行的脚本。 |
onforminput | script | 当表单获得用户输入时运行的脚本。 |
oninput | script | 当元素获得用户输入时运行的脚本。 |
oninvalid | script | 当元素无效时运行的脚本。 |
属性 | 值 | 描述 |
---|---|---|
ondrag | script | 元素被拖动时运行的脚本。 |
ondragend | script | 在拖动操作末端运行的脚本。 |
ondragenter | script | 当元素元素已被拖动到有效拖放区域时运行的脚本。 |
ondragleave | script | 当元素离开有效拖放目标时运行的脚本。 |
ondragover | script | 当元素在有效拖放目标上正在被拖动时运行的脚本。 |
ondragstart | script | 在拖动操作开端运行的脚本。 |
ondrop | script | 当被拖元素正在被拖放时运行的脚本。 |
onmousewheel | script | 当鼠标滚轮正在被滚动时运行的脚本。 |
onscroll | script | 当元素滚动条被滚动时运行的脚本。 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using viewport meta tags to control page scaling on mobile devices, focusing on settings like width and initial-scale for optimal responsiveness and performance.Character count: 159

This article explains how to embed audio in HTML5 using the <audio> element, including best practices for format selection (MP3, Ogg Vorbis), file optimization, and JavaScript control for playback. It emphasizes using multiple audio f

This article details creating interactive HTML5 games using JavaScript. It covers game design, HTML structure, CSS styling, JavaScript logic (including event handling and animation), and audio integration. Essential JavaScript libraries (Phaser, Pi

This article explains how to create and validate HTML5 forms. It details the <form> element, input types (text, email, number, etc.), and attributes (required, pattern, min, max). The advantages of HTML5 forms over older methods, incl

The article discusses using the HTML5 Page Visibility API to detect page visibility, improve user experience, and optimize resource usage. Key aspects include pausing media, reducing CPU load, and managing analytics based on visibility changes.

The article discusses managing user location privacy and permissions using the Geolocation API, emphasizing best practices for requesting permissions, ensuring data security, and complying with privacy laws.

The article explains how to use the HTML5 Drag and Drop API to create interactive user interfaces, detailing steps to make elements draggable, handle key events, and enhance user experience with custom feedback. It also discusses common pitfalls to a

This article explains the HTML5 WebSockets API for real-time, bidirectional client-server communication. It details client-side (JavaScript) and server-side (Python/Flask) implementations, addressing challenges like scalability, state management, an
