<docbook><section><title>OATDOCevents</title><para> </para>
<title> Event handling basics</title> Event handling basics
<para>Event handling is very simple in this toolkit.
 There are two routines that accomplish this:</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> OAT.Event.attach(element, event, functionReference)</bridgehead>
<para>First argument specifies an element which should detect the event.
 Second is the event (without the &#39;on&#39; prefix).
 Last argument is a valid function reference, i.e., the name of an existing function or Anonymous function.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Examples</bridgehead>
<programlisting>var div = OAT.Dom.create(&quot;div&quot;);
OAT.Event.attach(div, &quot;mouseover&quot;, function() { alert(&#39;Hi!&#39;); });
</programlisting><para> or</para>
<programlisting>OAT.Event.attach(&quot;some_id&quot;, &quot;click&quot;, genericFunctionReference);
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> OAT.Event.detach(element, event, functionReference)</bridgehead>
<para>Use the same syntax as inOAT.Event.attach().: <ulink url="ThefunctionReferenceargument">ThefunctionReferenceargument</ulink> must exist in the current scope, so it is not possible to remove aneventhandled by anonymous function.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Example</bridgehead>
<programlisting>OAT.Event.detach(element, &quot;click&quot;, functionReference);
</programlisting><para> <ulink url="CategoryDocumentation">CategoryDocumentation</ulink> <ulink url="CategoryOAT">CategoryOAT</ulink> <ulink url="CategoryOpenSource">CategoryOpenSource</ulink></para>
</section></docbook>