JavaScript Events
JavaScript Events
JavaScript Events are actions or occurrences that happen in the browser.
They can be triggered by various user interactions or by the browser itself.
Common events include mouse clicks, keyboard presses, page loads, and
form submissions. Event handlers are JavaScript functions that respond
to these events, allowing developers to create interactive web applications.
Common JavaScript Events
onclick: Triggered when an element is
clicked.
onmouseover: Fired when the mouse pointer
moves over an element.
onmouseout: Occurs when the mouse pointer
leaves an element.
onkeydown: Fired when a key is pressed
down.
onkeyup: Fired when a key is released.
onchange: Triggered when the value of
an input element changes.
onload: Occurs when a page has
finished loading.
onsubmit: Fired when a form is
submitted.
onfocus: Occurs when an element gets
focus.
onblur: Fired when an element loses
focus.
Java script Events can be
placed within single quotes or double quotes
Ex1.
JavaScript
Code
Output
Ex.2
Javascript Code
Output
Ex.3
Javascript Code
Output
Ex.4
Javascript Code
Output
Ex.5
Javascript Code
Output
Ex.6
Javascript Code
Output
Ex.7
Javascript Code
Output
Ex.8
Javascript Code
Output
Common HTML Events
Here
is a list of some common HTML events:
Event |
Description |
onchange |
An
HTML element has been changed |
onclick |
The
user clicks an HTML element |
onmouseover |
The
user moves the mouse over an HTML element |
onmouseout |
The
user moves the mouse away from an HTML element |
onkeydown |
The
user pushes a keyboard key |
onload |
The
browser has finished loading the page |
Thanks for this useful information.
ReplyDeleteWelcome to the world of BIIT Technology, where we offer thebest computer course in Laxmi Nagar. Our courses are designed to equip you with the skills and knowledge needed to succeed in today's digital age.