Professional Documents
Culture Documents
Experiment 4
Experiment 4
Experiment 4
Aim: Design a form, with different form fields e.g. text fields, password fields, checkboxes, radio
buttons, sliders. Write Java Script for client side validation.
Theory:
Javascript can be placed in any number of scripts in an HTML document.Scripts can be placed
in the <body>, or in the <head> section of an HTML page, or in both or it can also be externally
present external to the HTML file.
HTML events are "things" that happen to HTML elements. When JavaScript is used in HTML
pages, JavaScript can "react" to these events. An HTML event can be something the browser
does, or something a user does. Often, when events happen, you may want to do something.
JavaScript lets you execute code when events are detected. HTML allows event handler
attributes, with JavaScript code, to be added to HTML elements.
List of common HTML elements:
Event Description
onmouseout The user moves the mouse away from an HTML element
Event handlers can be used to handle and verify user input, user actions, and browser actions:
● Things that should be done every time a page loads
● Things that should be done when the page is closed
● Action that should be performed when a user clicks a button
● Content that should be verified when a user inputs data
● And more …
Avanti Bhondwe D16 49
Conclusion:
HTML events are occurrences that can be accessed by Javascript event handlers to act on which
can be used to run some scripts in the background that can be used to change the
DOMstructure or perform requests.
Mmmmppphhh
Avanti Bhondwe D16 49