亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

HTML 參考手冊

HTML 標(biāo)簽大全

HTML 事件

事件處理器的值是一個(gè)或一系列以分號(hào)隔開的 Javascript 表達(dá)式、方法和函數(shù)調(diào)用,并用引號(hào)引起來。當(dāng)事件發(fā)生時(shí),瀏覽器會(huì)執(zhí)行這些代碼。

全局事件屬性

HTML 4 的新特性之一是可以使 HTML 事件觸發(fā)瀏覽器中的行為,比方說當(dāng)用戶點(diǎn)擊某個(gè) HTML 元素時(shí)啟動(dòng)一段 JavaScript。

下面的表格提供了標(biāo)準(zhǔn)的事件屬性,可以把它們插入 HTML/XHTML 元素中,以定義事件行為。

HTML5 : HTML5新增屬性事件。

窗口事件屬性(Window Event Attributes)

由窗口觸發(fā)該事件 (適用于 <body> 標(biāo)簽):

屬性描述
onafterprintHTML5script在打印文檔之后運(yùn)行腳本
onbeforeprintHTML5script在文檔打印之前運(yùn)行腳本
onbeforeonloadHTML5script在文檔加載之前運(yùn)行腳本
onblurscript當(dāng)窗口失去焦點(diǎn)時(shí)運(yùn)行腳本
onerrorHTML5script當(dāng)錯(cuò)誤發(fā)生時(shí)運(yùn)行腳本
onfocusscript當(dāng)窗口獲得焦點(diǎn)時(shí)運(yùn)行腳本
onhaschangeHTML5script當(dāng)文檔改變時(shí)運(yùn)行腳本
onloadscript當(dāng)文檔加載時(shí)運(yùn)行腳本
onmessageHTML5script當(dāng)觸發(fā)消息時(shí)運(yùn)行腳本
onofflineHTML5script當(dāng)文檔離線時(shí)運(yùn)行腳本
ononlineHTML5script當(dāng)文檔上線時(shí)運(yùn)行腳本
onpagehideHTML5script當(dāng)窗口隱藏時(shí)運(yùn)行腳本
onpageshowHTML5script當(dāng)窗口可見時(shí)運(yùn)行腳本
onpopstateHTML5script當(dāng)窗口歷史記錄改變時(shí)運(yùn)行腳本
onredoHTML5script當(dāng)文檔執(zhí)行再執(zhí)行操作(redo)時(shí)運(yùn)行腳本
onresizeHTML5script當(dāng)調(diào)整窗口大小時(shí)運(yùn)行腳本
onstorageHTML5script當(dāng) Web Storage 區(qū)域更新時(shí)(存儲(chǔ)空間中的數(shù)據(jù)發(fā)生變化時(shí))運(yùn)行腳本
onundoHTML5script當(dāng)文檔執(zhí)行撤銷時(shí)運(yùn)行腳本
onunloadHTML5script當(dāng)用戶離開文檔時(shí)運(yùn)行腳本

表單事件(Form Events)

表單事件在HTML表單中觸發(fā) (適用于所有 HTML 元素, 但該HTML元素需在form表單內(nèi)):

屬性描述
onblurscript當(dāng)元素失去焦點(diǎn)時(shí)運(yùn)行腳本
onchangescript當(dāng)元素改變時(shí)運(yùn)行腳本
oncontextmenuHTML5script當(dāng)觸發(fā)上下文菜單時(shí)運(yùn)行腳本
onfocusscript當(dāng)元素獲得焦點(diǎn)時(shí)運(yùn)行腳本
onformchangeHTML5script當(dāng)表單改變時(shí)運(yùn)行腳本
onforminputHTML5script當(dāng)表單獲得用戶輸入時(shí)運(yùn)行腳本
oninputHTML5script當(dāng)元素獲得用戶輸入時(shí)運(yùn)行腳本
oninvalidHTML5script當(dāng)元素?zé)o效時(shí)運(yùn)行腳本
onresetscript當(dāng)表單重置時(shí)運(yùn)行腳本。HTML 5 不支持。
onselectscript當(dāng)選取元素時(shí)運(yùn)行腳本
onsubmitscript當(dāng)提交表單時(shí)運(yùn)行腳本

鍵盤事件(Keyboard Events)

屬性描述
onkeydownscript當(dāng)按下按鍵時(shí)運(yùn)行腳本
onkeypressscript當(dāng)按下并松開按鍵時(shí)運(yùn)行腳本
onkeyupscript當(dāng)松開按鍵時(shí)運(yùn)行腳本

鼠標(biāo)事件(Mouse Events)

通過鼠標(biāo)觸發(fā)事件, 類似用戶的行為:

屬性描述
onclickscript當(dāng)單擊鼠標(biāo)時(shí)運(yùn)行腳本
ondblclickscript當(dāng)雙擊鼠標(biāo)時(shí)運(yùn)行腳本
onmousedownscript當(dāng)按下鼠標(biāo)按鈕時(shí)運(yùn)行腳本
onmousemovescript當(dāng)鼠標(biāo)指針移動(dòng)時(shí)運(yùn)行腳本
onmouseoutscript當(dāng)鼠標(biāo)指針移出元素時(shí)運(yùn)行腳本
onmouseoverscript當(dāng)鼠標(biāo)指針移至元素之上時(shí)運(yùn)行腳本
onmouseupscript當(dāng)松開鼠標(biāo)按鈕時(shí)運(yùn)行腳本
onmousewheelHTML5script當(dāng)轉(zhuǎn)動(dòng)鼠標(biāo)滾輪時(shí)運(yùn)行腳本

拖動(dòng)事件(Drag Events)

通過拖動(dòng)鼠標(biāo)觸發(fā)事件, 類似用戶的行為:

屬性描述
ondragHTML5script當(dāng)拖動(dòng)元素時(shí)運(yùn)行腳本
ondragendHTML5script當(dāng)拖動(dòng)操作結(jié)束時(shí)運(yùn)行腳本
ondragenterHTML5script當(dāng)元素被拖動(dòng)至有效的拖放目標(biāo)時(shí)運(yùn)行腳本
ondragleaveHTML5script當(dāng)元素離開有效拖放目標(biāo)時(shí)運(yùn)行腳本
ondragoverHTML5script當(dāng)元素被拖動(dòng)至有效拖放目標(biāo)上方時(shí)運(yùn)行腳本
ondragstartHTML5script當(dāng)拖動(dòng)操作開始時(shí)運(yùn)行腳本
ondropHTML5script當(dāng)被拖動(dòng)元素正在被拖放時(shí)運(yùn)行腳本
onscrollHTML5script當(dāng)滾動(dòng)元素的滾動(dòng)條時(shí)運(yùn)行腳本

多媒體事件(Media Events)

通過視頻(videos),圖像(images)或者音頻(audio) 觸發(fā)該事件,多應(yīng)用于HTML媒體元素比如 <audio>, <embed>, <img>, <object>, 和<video>):

屬性描述
onabortscript當(dāng)發(fā)生中止事件時(shí)運(yùn)行腳本
oncanplayHTML5script當(dāng)媒介能夠開始播放但可能因緩沖而需要停止時(shí)運(yùn)行腳本
oncanplaythroughHTML5script當(dāng)媒介能夠無需因緩沖而停止即可播放至結(jié)尾時(shí)運(yùn)行腳本
ondurationchangeHTML5script當(dāng)媒介長度改變時(shí)運(yùn)行腳本
onemptiedHTML5script當(dāng)媒介資源元素突然為空時(shí)(網(wǎng)絡(luò)錯(cuò)誤、加載錯(cuò)誤等)運(yùn)行腳本
onendedHTML5script當(dāng)媒介已抵達(dá)結(jié)尾時(shí)運(yùn)行腳本
onerrorHTML5script當(dāng)在元素加載期間發(fā)生錯(cuò)誤時(shí)運(yùn)行腳本
onloadeddataHTML5script當(dāng)加載媒介數(shù)據(jù)時(shí)運(yùn)行腳本
onloadedmetadataHTML5script當(dāng)媒介元素的持續(xù)時(shí)間以及其他媒介數(shù)據(jù)已加載時(shí)運(yùn)行腳本
onloadstartHTML5script當(dāng)瀏覽器開始加載媒介數(shù)據(jù)時(shí)運(yùn)行腳本
onpauseHTML5script當(dāng)媒介數(shù)據(jù)暫停時(shí)運(yùn)行腳本
onplayHTML5script當(dāng)媒介數(shù)據(jù)將要開始播放時(shí)運(yùn)行腳本
onplayingHTML5script當(dāng)媒介數(shù)據(jù)已開始播放時(shí)運(yùn)行腳本
onprogressHTML5script當(dāng)瀏覽器正在取媒介數(shù)據(jù)時(shí)運(yùn)行腳本
onratechangeHTML5script當(dāng)媒介數(shù)據(jù)的播放速率改變時(shí)運(yùn)行腳本
onreadystatechangeHTML5script當(dāng)就緒狀態(tài)(ready-state)改變時(shí)運(yùn)行腳本
onseekedHTML5script當(dāng)媒介元素的定位屬性 [1] 不再為真且定位已結(jié)束時(shí)運(yùn)行腳本
onseekingHTML5script當(dāng)媒介元素的定位屬性為真且定位已開始時(shí)運(yùn)行腳本
onstalledHTML5script當(dāng)取回媒介數(shù)據(jù)過程中(延遲)存在錯(cuò)誤時(shí)運(yùn)行腳本
onsuspendHTML5script當(dāng)瀏覽器已在取媒介數(shù)據(jù)但在取回整個(gè)媒介文件之前停止時(shí)運(yùn)行腳本
ontimeupdateHTML5script當(dāng)媒介改變其播放位置時(shí)運(yùn)行腳本
onvolumechangeHTML5script當(dāng)媒介改變音量亦或當(dāng)音量被設(shè)置為靜音時(shí)運(yùn)行腳本
onwaitingHTML5script當(dāng)媒介已停止播放但打算繼續(xù)播放時(shí)運(yùn)行腳本

其他事件

屬性描述
onshowHTML5script當(dāng) <menu> 元素在上下文顯示時(shí)觸發(fā)
ontoggleHTML5script當(dāng)用戶打開或關(guān)閉 <details> 元素時(shí)觸發(fā)