Chapter 9: Interactive Data on the World-Wide Web

Lesson Goals

Students can use JavaScript to respond to user actions and retrieve data from remote Web sites.

Lesson Outcomes

Students can:

  • Connect interactive HTML elements with JavaScript functions to process user-generated events
  • Download data and process it to build Web pages asynchronously.

Introduction

The real power of JavaScript comes from its ability to respond to user activities by modifying a Web page in some way, perhaps by first downloading additional data.

Links, buttons, paragraphs, or any element, actually, can respond to certain types of user interactions, whether they are clicks, mouse overs, window scrolls or resizes, etc.

All of these actions are asynchronous, occurring at unknown times, rather than sequentially as a Web page is built and JavaScript is executed, as we’ve seen in the previous sections.

To capture these user-generated activities, as well as others that might be triggered by server response, a particular clock time, etc., the Document Object Model defines a large number of events to which its elements can respond, by executing functions known as event handlers.

results matching ""

    No results matching ""