Declares an event listener and registers it with a specific element.
There is partial support for DOM Level 2 mouse and HTML events, and XForms interaction and notification events. See Scripting in XDIME 2 for details.
Attribute | Description | Type | Default | Options | Use |
---|---|---|---|---|---|
event | Specifies the event type for the listener | xs:QName | required | ||
handler | URI for the resource that defines the action to be performed. Must be a fragment identifier that references an element with a matching id attribute in the current document. | xs:anyURI | required | ||
observer | Identifies the element that the listener is registered with | xs:IDREF | required |
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs"
xmlns:event="http://www.w3.org/2001/xml-events">
<head>
<title>Welcome to XDIME Events</title>
</head>
<body>
<mcs:handler id="handler" type="text/javascript">alert('hello')</mcs:handler>
<event:listener observer="p" handler="#handler" event="click"/>
<p id="p">Click me!</p>
</body>
</html>