Preview

15 - JavaScript Events

 1. JavaScript's interaction with HTML is handled through ______ that occur when the user or the browser manipulates a page
Note: It is important to note that web events are not part of the core JavaScript language — they are defined as part of the JavaScript APIs built into the browser.

  clicks

  events

  variables

  scripts

 2. Which of the following is an example of an HTML event?
An HTML web page has finished loading
An HTML input field was changed
An HTML button was clicked

  None of the items on the list are valid events

  An HTML button was clicked

  All of the items on the list are valid events

  An Html page web page has finished loading

 3. Each available event has an ________________, which is a block of code (usually a user-defined JavaScript function) that will be run when the event fires.

  event method

  event handler

  event variable

  addler

 4. HTML allows ________________________, with JavaScript code, to be added to HTML elements
With single quotes:

<element event='some JavaScript'>
With double quotes:

<element event="some JavaScript">

  property methods

  method handlers

  event handler attributes

  script properties

 5. Which statement describes what is happening in this code?
<!DOCTYPE html>
<html>
<body>

<button onclick="document.getElementById('demo').innerHTML=Date()">The time is?</button>

<p id="demo"></p>

</body>
</html>

  an onclick attribute (with code), is added to a button element:

  an onButton property (with code), is added to an onclick event

  an onclick property (without code) is added to a text element

  a button element (with code) is added to an onclick event

 6. The following list shows some very common HTML events
Event	        Description
=======         ===========
onchange	An HTML element has been changed
onclick	        The user clicks an HTML element
onmouseover	The user moves the mouse over an HTML element
onmouseout	The user moves the mouse away from an HTML element
onkeydown	The user pushes a keyboard key
onload	        The browser has finished loading the page

  TRUE

  FALSE

 7. The onsubmit event is used in this example. Here we are calling the ____________before submitting form data to the web server.

  form method

  validation function

  submit function

  input type submit function

 8. Match the event to the description
Triggers when a mouse button is released

  onmouseup

  onselect

  onloadstart

  onfocus

 9. Match the event to the description
Triggers when an element is selected

  onfocus

  onloadstart

  onselect

  onmouseup

 10. If you want to target a touch-enabled device like an iPad, iPhone, Android tablet or phone, etc, then you need the _______________.
These events are touchstart, touchend, touchcancel, touchleave, touchmove.

  mouse events

  touch events

  None of these answers are valid

  screen events