WEB6
WEB6
Aim
• WAP to implement various functions of DOM.
• Demonstrate use of on mouse move and on mouse over event.
• Display a message “welcome to scripting” when a button labelled “hello” is clicked.
Display a message “Thank you for using scripting” when the same button is double
clicked.
Overview
Event:
An action or occurrence recognized by the browser, such as a mouse click, key press,
or mouse movement. JavaScript can respond to these events to create interactive
web pages.
Event Handler:
A function that executes in response to a specific event. For example, when a button
is clicked, the associated event handler is called to perform a task.
`addEventListener()`:
A method used to attach an event handler to a specified element. It allows the
specified function to be executed when the event occurs. This method can handle
multiple events on the same element.
`mouseover` Event:
An event that occurs when the mouse pointer enters an element. This can be used to
trigger effects like changing the background color or text of the element.
`text Content`:
A property that gets or sets the text content of an element. It can be used to change
the displayed text without affecting the HTML structure.
IMPLEMENTATION
(HTML + JAVASCRIPT Code)
OUTPUT:
✓ Learned to manipulate the Document Object Model (DOM) by selecting and modifying
HTML elements using JavaScript.
✓ Learned to handle mouse events (mousemove and mouseout) to create dynamic
interactions that enhance user experience.
✓ Learned to use alert() for displaying messages and console.log()