Chapter 13

13.1

Fill in the blanks in each of the following statements:

a) Event handlers can be registered in XHTML using the inline model or in JavaScript using the traditional model.

b) The state of three keys can be retrieved by using the event object. These keys are Ctrl, Alt and Shift.

c) If a child element does not handle an event, event bubbling lets the event rise through the object hierarchy.

d) The return value of an event-handling function specifies whether to perform the default action for the event.

e) In an event handler, the reference for the id of an element that fired an event is event.target.id in Firefox and event.srcElement.id in Internet Explorer.

f) Three events that fire when the user clicks the mouse are onclick, onmousedown and onmouseup.

13.2

State whether each of the following is true or false. If the statement is false, explain why.

a) The onlad event fires whenever an element starts loading. False. The onload event fires when an element finishes loading.

b) The onclick event fires when the user clicks the mouse on an element. True.

c) The onfocus event fires when and element loses focus. False. It fires when an element gains focus.

d) When using the rollover effect with images, it is a good practice to create Image objects that preload the desired images. True.

e) Returning true in an event handler on an a (anchor) element prevents the browser from following the link when the event handler finishes. False. Returning false prevents the default action.

13.6

13.7

13.8

News:

Working on Chapter 15