Event Binding in (X)HTML

Table 11-2: Basic Events and Their Corresponding Event Handler Attributes in (X)HTML

Event Attribute

Event Description

Allowed Elements Under
Standard (X)HTML

onblur

Occurs when an element loses focus, meaning that the user has activated another element, typically either by clicking the other element
or tabbing to it.

<a>, <area>, <button>, <input>, <label>, <select>, <textarea>
Also <applet>, <area>, <div>, <embed>, <hr>, <img>, <marquee>, <object>, <span>, <table>, <td>, <tr>
In IE4+ and N4 also <body>
In N4 also <frameset>, <ilayer>, <layer>

onchange

Signals that the form field has lost user focus and its value has been modified during this
last access.

<input>, <select>, <textarea>

onclick

Indicates that the element has been clicked.

Most display elements*
In IE4+ also <applet>, <font>

ondblclick

Indicates that the element has been
double-clicked.

Most display elements*
In IE4+ also <applet>, <font>

onfocus

Indicates that the element has received focus; in other words, it has been selected by the user for manipulation or data entry.

<a>, <area>, <button>, <input>, <label>, <select>, <textarea>
In IE4+ also <applet>, <div>, <embed>, <hr>, <img>, <marquee>, <object>, <span>, <table>, <td>, <tr>
In IE4+ and N4 also <body>
In N4 also <frameset>, <ilayer>, <layer>

onkeydown

Indicates that a key is being pressed down with focus on the element.

Most display elements*
In IE4+ also <applet>, <font>

onkeypress

Indicates that a key has been pressed and released with focus on the element.

Most display elements*
In IE4+ also <applet>, <font>

onkeyup

Indicates that a key is being released with focus on the element.

Most display elements*
In IE4+ also <applet>, <font>

onload

Indicates that the object (typically a window or frame set) has finished loading into the browser.

<body>, <frameset>
In IE4+ also <applet>, <embed>, <link>, <script>, <style>
In N4 also <ilayer>, <layer>
In IE4+ and N4 also <img>

onmousedown

Indicates the press of a mouse button with focus on the element.

Most display elements*
In IE4+ also <applet>, <font>

onmousemove

Indicates that the mouse has moved while over the element.

Most display elements*
In IE4+ also <applet>, <font>

onmouseout

Indicates that the mouse has moved away from
an element (i.e., is no longer above the element).

Most display elements*
In IE4+ also <applet>, <font>
In N4 also <ilayer>, <layer>

onmouseover

Indicates that the mouse has moved over
the element.

Most display elements*
In IE4+ also <applet>, <font>
In N4 also <ilayer>, <layer>

onmouseup

Indicates the release of a mouse button with focus on the element.

Most display elements*
In IE4+ also <applet>, <font>

onreset

Indicates that the form is being reset, possibly by the press of a reset button.

<form>

onselect

Indicates the selection of text by the user, typically by highlighting it with the mouse.

<input>, <textarea>

onsubmit

Indicates that the form is about to be submitted, generally the result of activating a Submit button.

<form>

onunload

Indicates that the browser is navigating away from the current document, and unloading it from the window or frame.

<body>, <frameset>

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值