Events
The trick to calling functions is to use events to do the work for you. JavaScript is event-driven, which means everything that happens is the result of an event or causes some event to occur. Opening a new page in the browser window is an event. Moving the mouse pointer is an event. Clicking is an event. The four events you will use the most in this book are
onLoad
onClick
onMouseover
onMouseout
Let's run through each of these quickly so that you're familiar with them before we continue.
The onLoad Event
The onLoad event is the event that occurs when something has loaded—for example, the browser has finished loading a page into the browser window. This event occurs only when all of the page (including images if they are set to load) has ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access