457). When are the mouse events generated?
[A]When user clicks the mouse over a document
[B]When user moves over a document
[C]On pressing a key
[D]When user clicks or moves the mouse over a document
Show Answer
Correct Answer: When user clicks or moves the mouse over a document
Notes:
Answer: d
Explanation: Mouse events are generated when the user moves or clicks the mouse over a document. These events are triggered on the most deeply nested element that the mouse pointer is over, but they bubble up through the document.
458). The properties that specify the position and button state of the mouse are _________
[A]clientX and clientY
[B] clientY and clientX
[C]altKey and ctrlKey
[D]metaKey and shiftKey
Show Answer
Correct Answer: clientX and clientY
Notes:
Answer: a
Explanation: The clientX and clientY properties specify the position of the mouse in window coordinates. The clientX property returns the horizontal coordinate (according to the client area) of the mouse pointer when a mouse event was triggered. Similarly clientY returns the vertical coordinates.
459). Which of the following keys are not set to true when the keyboard modifier keys are held down?
[A]altKey
[B]ctrlKey
[C]metaKey
[D]delkey
Show Answer
Correct Answer: delkey
Notes:
Answer: d
Explanation: A modifier key is a key that modifies the action of another key when the two are pressed together. The altKey, ctrlKey, metaKey, and shiftKey properties are set to true when the corresponding keyboard modifier keys are held down.
460). How to detect and respond to mouse drags?
[A]Registering a mouseover handler
[B]Releasing a mousedown handler
[C]Registering a mousedown handler
[D]Releasing a mouseover handler
Show Answer
Correct Answer: Registering a mousedown handler
Notes:
Answer: c
Explanation: By registering a mousedown handler that registers a mousemove handler, you can detect and respond to mouse drags. Doing this properly involves being able to capture mouse events so that you continue to receive mousemove events even when the mouse has moved out of the element it started in.
461). When is the mouseover event fired?
[A]When mouse is moved over a new element
[B]When mouse is clicked
[C]When mouse is both moved and clicked
[D]When mouse is released
Show Answer
Correct Answer: When mouse is moved over a new element
Notes:
Answer: a
Explanation: When the user moves the mouse so that it goes over a new element, the browser fires a mouseover event on that element. The onmouseover event occurs when the mouse pointer is moved onto an element, or onto one of its children.
462). When is the mouseout event fired?
[A]When mouse is no longer over an element
[B]When mouse is over an element
[C]When mouse is hovered
[D]When mouse is clicked
Show Answer
Correct Answer: When mouse is no longer over an element
Notes:
Answer: a
Explanation: When the mouse moves so that it is no longer over an element, the browser fires a mouseout event on that element. The mouseout() method triggers the mouseout event, or attaches a function to run when a mouseout event occurs
463). The focus and blur events are also part of _________
[A]Element events
[B]Handler events
[C]Window events
[D] Scroll events
Show Answer
Correct Answer: Window events
Notes:
Answer: c
Explanation: The focus and blur events are also used as Window events: they are triggered on a window when that browser window receives or loses keyboard focus from the operating system. Focusin and onblur methods are used for using these events.
464). The element that can also register handlers for load and error events is _________
[A]html
[B]img
[C]body
[D]form
Show Answer
Correct Answer: img
Notes:
Answer: b
Explanation: Individual document elements, such as img elements, can also register handlers for load and error events.onload and onerror methods are used for handling such events.
465). The events that are emulated by the jQuery library are _________
[A]focusarea and focusover
[B]focusall and focusnone
[C]focusdown and focusup
[D] focusin and focusout
Show Answer
Correct Answer: focusall and focusnone
Notes:
Answer: b
Explanation: The jQuery library emulates focusin and focusout events for browsers that do not support them. The focusin and focusout events bubble, the focus and blur events doesn’t. That means that you can use the focusin and focusout on the parent element of a form field.
466). Which event is triggered sooner when the document and its elements are ready to manipulate?
[A]DOMContentLoaded
[B]readystatechange
[C]Both DOMContentLoaded & readystatechange
[D]Statechange
Show Answer
Correct Answer: Both DOMContentLoaded & readystatechange
Notes:
Answer: c
Explanation: DOMContentLoaded and readystatechange are alternatives to the load event: they are triggered sooner, when the document and its elements are ready to manipulate, but before external resources are fully loaded.