Home > Articles > Open Source > Ajax & JavaScript

  • Print
  • + Share This
This chapter is from the book

Quiz

Test your knowledge of event handlers in JavaScript by answering the following questions.

Questions

  1. Which of the following is the correct event handler to detect a mouse click on a link?

    1. onMouseUp

    2. onLink

    3. onClick

  2. When does the onLoad event handler for the <body> tag execute?

    1. When an image is finished loading.

    2. When the entire page is finished loading.

    3. When the user attempts to load another page.

  3. Which of the following event object properties indicates which key was pressed for an onKeyPress event in Internet Explorer?

    1. event.which

    2. event.keyCode

    3. event.onKeyPress

Answers

  1. c. The event handler for a mouse click is onClick.

  2. b. The <body> tag's onLoad handler executes when the page and all its images are finished loading.

  3. b. In Internet Explorer, the event.keyCode property stores the character code for each keypress.

  • + Share This
  • 🔖 Save To Your Account