Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Ajax and JavaScript

  • Print
  • + Share This
Like this article? We recommend Detecting the Load Event

Detecting the Load Event

We want our code to add an image to the web page. To do this, we must modify the Document Object Model (DOM), which is the browser's view of your markup.

Fortunately for us, the browser is constantly broadcasting messages telling JavaScript about various page and user events, such as mouse clicks and key presses. One of these events, load, is fired when the document is fully loaded in the browser. That's the moment we want to call a JavaScript function that does the work of selecting and adding the image to the page.

  • + Share This
  • 🔖 Save To Your Account