Event Listeners

error Event Listeners

When an error event is propagated to a node, any registered event listener functions of type error are invoked. The error event listener function takes three parameters and returns a boolean value:

fn(DOMString message, DOMString url, DOMString lineNumber)
The function to be dispatched when an error event is propagated to the node that the event listener is attached to.
Parameters:
message - the message being reported
url - absolute URL of the resource (document) in which the error occurred
lineNumber - in that resource, the line number where the error occurred
Return value:
event.returnValue = false if the error has been handled by this function or event.returnValue = true if not
mouseover Event Listeners

When a mouseover event is propagated to a node, any registered event listener functions of type mouseover are invoked. The mouseover event listener function takes one parameter and returns a boolean value:

fn(Event event)
The function to be dispatched when a mouseover event is propagated to the node that the event listener is attached to.
Parameters:
event - the event
Return value:
event.returnValue = true if the event is to be cancelled or event.returnValue = false if not

Note that the return value for mouseover event listeners is the opposite from the return value for other event listeners (below).

beforeunload Event Listeners

When a beforeunload event is propagated to a node, any registered event listener functions of type beforeunload are invoked. the beforeunload event listener takes one parameter and returns a string value:

fn(Event event)
The function to be dispatched when a beforeunload event is propagated to the node that the event listener is attached to.
Parameters:
event - the event
Return value:
event.returnValue = "Prompt text" to display a prompt for the user to confirm leaving the page or event.returnValue = "" if not
Other Event Listeners

When any other event is propagated to a node, any registered event listener functions of the matching type are invoked. The event listener function takes one parameter and returns a boolean value:

fn(Event event)
The function to be dispatched when an event is propagated to the node that the event listener is attached to.
Parameters:
event - the event
Return value:
event.returnValue = false if the event is to be cancelled or event.returnValue = true if not