Home >>XHTML Tutorial >XHTML Events
If you visit a page, you do stuff like clicking on the text, images and hyperlinks, things that are hovering over, etc. There are instances of what JavaScript is called events.
We may write our event handlers in JavaScript or VBScript and define such event handlers as an attribute value for the event tag. The XHTML 1.0 provides a common collection of events that is included in standard HTML 4.01.
When any occurrence happens at document stage, there are only two attributes that can be used to cause any JavaScript or VBScript code.
Attribute | Value | Description |
---|---|---|
onload | Script | Script runs when a XHTML document loads. |
onunload | Script | Script runs when a XHTML document unloads. |
There are six attributes that are activated at type level when some event happens.
Attribute | Value | Description |
---|---|---|
onchange | Script | Script executes when the element changes. |
onsubmit | Script | Script executes when the form is submitted. |
onreset | Script | Script executes when the form is reset. |
onselect | Script | Script executes when the element is selected. |
onblur | Script | Script executes when the element loses focus. |
onfocus | Script | Script runs when the element gets focus. |
Three events are created by keyboard. The keyboard events are invalid in elements of foundation, bdo, br, frame, frameset, head, html, iframe, meta, parameters, script, type, and description.
Attribute | Value | Description |
---|---|---|
onkeydown | Script | Script executes on key press. |
onkeypress | Script | Script executes on key press and release. |
onkeyup | Script | Script executes key releas |
There are certain events created by the mouse that execute when it comes into contact with some HTML tag. Such events are not true in elements of foundation, bdo, br, frame, frameset, head, html, iframe, meta, parameter, script, type, and description.
Attribute | Value | Description |
---|---|---|
onclick | Script | It is executes on a mouse click. |
ondblclick | Script | It is executes on a mouse double-click. |
onmousedown | Script | It is executes when mouse button is pressed. |
onmousemove | Script | It is executes when mouse pointer moves. |
onmouseout | Script | It is executes when mouse pointer moves out of an element. |
onmouseover | Script | It is executes when mouse pointer moves over an element. |
onmouseup | Script | It is executes when mouse button is released. |