About Attributes

Event Attributes

Here we are going to list some event attributes within different subheadings which shows you that what type of event attributes are used within which html tag. So take a look-

<body> and <frameset> Events-

These attributes are normally used for <body> and <frameset> elements.

AttributeDescription
onloadIn this case the script runs when the document take load
onunloadIn this case the script runs when the document unload

<form> Events-

These attributes are normally used for <form> elements.

AttributeDescription
onblurIn this case the script runs when an element loses focus
onchangeIn this case the script runs when an element get change
onfocusIn this case the script runs when the element gets focus
onresetIn this case the script runs when the form is reset
onselectIn this case the script runs when the element is selected
onsubmitIn this case the script runs when the form is submitted

Image Events-

The given attribute is normally used for <img> element.

AttributeDescription
onabortIn this case the script runs when loading of an image is interrupted

Keyboard Events-

These attributes are normally used for all the elements except the <base>, <bdo>, <br>, <frame>, <frameset>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style >and <title> elements.

AttributeDescription
onkeydownIn this case the script runs when the key is pressed
onkeypressIn this case the script runs when the key is pressed and released
onkeyupIn this case the script runs when the key is released

Mouse Events-

These attributes are normally used for all the elements except the <base>, <bdo>, <br>, <frame>, <frameset>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style >and <title> elements.

AttributeDescription
onclickIn this case the script runs on the mouse click
ondblclickIn this case the script runs on the mouse double click
onmousedownIn this case the script runs when the mouse button is pressed
onmousemoveIn this case the script runs when the mouse pointer moves
onmouseoutIn this case the script runs when the mouse pointer moves out of the element
onmouseoverIn this case
Toggle Sidebar