• Topic
  • Discussion
  • OATWikiWeb.OATDOCevents(Last) -- Owiki? , 2016-08-19 14:58:51 Edit owiki 2016-08-19 14:58:51

    Event handling basics

    Event handling is very simple in this toolkit. There are two routines that accomplish this:

    OAT.Event.attach(element, event, functionReference)

    First argument specifies an element which should detect the event. Second is the event (without the 'on' prefix). Last argument is a valid function reference, i.e., the name of an existing function or Anonymous function.


    var div = OAT.Dom.create("div");
    OAT.Event.attach(div, "mouseover", function() { alert('Hi!'); });


    OAT.Event.attach("some_id", "click", genericFunctionReference);

    OAT.Event.detach(element, event, functionReference)

    Use the same syntax as inOAT.Event.attach().: ThefunctionReferenceargument must exist in the current scope, so it is not possible to remove aneventhandled by anonymous function.


    OAT.Event.detach(element, "click", functionReference);

    Referenced by...