HTML 4.0 動作事件屬性
對HTML 4.0新的此項能力是讓HTML 事件觸發瀏覽器的行動, 如同用戶點擊HTML元素開啟Java 語言。下面是可能被插入入HTML
標示,去定義事件行動的屬性名單
就新版本的HTML4.0而言,就是可以讓HTML的事件啟動器,能夠啟動瀏覽器的動作,例如當使用者點選HTML元素時可以執行JavaScript 程式
視窗動作
只有主體及設定框架元素有效
| Attribute |
Value |
Description |
| onload |
script |
Script to be run when a document loads
|
| onunload |
script |
Script to be run when a document unloads
|
文字型式動作
僅限文字型式元素.
| Attribute |
Value |
Description |
| onchange |
script |
Script to be run when the element changes
|
| onsubmit |
script |
Script to be run when the form is submitted
|
| onreset |
script |
Script to be run when the form is reset
|
| onselect |
script |
Script to be run when the element is selected
|
| onblur |
script |
Script to be run when the element loses focus
|
| onfocus |
script |
Script to be run when the element gets focus |
鍵盤動作
對下列元素無效: base, bdo, br, frame, frameset, head, html, iframe, meta, param,
script, style, and title elements.
| Attribute |
Value |
Description |
| onkeydown |
script |
What to do when key is pressed |
| onkeypress |
script |
What to do when key is pressed and released |
| onkeyup |
script |
What to do when key is released |
滑鼠動作
同上
| Attribute |
Value |
Description |
| onclick |
script |
What to do on a mouse click
|
| ondblclick |
script |
What to do on a mouse double-click
|
| onmousedown |
script |
What to do when mouse button is pressed
|
| onmousemove |
script |
What to do when mouse pointer moves
|
| onmouseout |
script |
What to do when mouse pointer moves out of an element
|
| onmouseover |
script |
What to do when mouse pointer moves over an element
|
| onmouseup |
script |
What to do when mouse button is released
|
|