Page 141 - DCAP202_Fundamentals of Web Programming
P. 141
Fundamentals of Web Programming Pawan Kumar, Lovely Professional University
Notes Unit 11: Handling Events Using JavaScript
CONTENTS
Objectives
Introduction
11.1 Working on Event
11.1.1 onLoad and onUnload
11.1.2 onFocus, onBlur and onChange
11.1.3 onSubmit
11.1.4 onMouseOver and onMouseOut
11.2 onClick Event Handler and onSelect Event Handler
11.2.1 onClick Event Handler
11.2.2 onSelect Event Handler
11.3 Summary
11.4 Keywords
11.5 Review Questions
11.6 Further Readings
Objectives
After studying this unit, you will be able to:
Explain the working of event
Describe different events in JavaScript
Introduction
By using JavaScript, we have the ability to create dynamic web pages. Events are actions that can
be detected by JavaScript.
Every element on a web page has certain events which can trigger a JavaScript. For example, we
can use the onClick event of a button element to indicate that a function will run when a user
clicks on the button. We define the events in the HTML tags.
Examples of events:
A mouse click
A web page or an image loading
Mousing over a hot spot on the web page
Selecting an input field in an HTML form
Submitting an HTML form
A keystroke
134 LOVELY PROFESSIONAL UNIVERSITY