:: Home >>

setEvent

Assigns the HTML event handler.

Syntax

obj.setEvent(name, value);

Parameters

name (string) - event name
value (string or function) - event handler function

Example

obj.setEvent("onclick", myClickHandler);

Remarks

It is possible to pass a literal javascript code (string) as the value parameter. In this case the code will be simply put into the html attribute -

obj.setEvent("onclick", "alert(this.id)");

It will produce -

<div id="aw123" onclick="alert(this.id)" >...</div>

But more often the value parameter is an event handler function.

obj.setEvent("onclick", function(event){...});

In this case AW will catch the event, find the original AW object and call the event handler as a method of this object with the event as an argument.

See also

getEvent() method

Comments

14 Apr 08
multiple events rodrigo talento (6)
2 Apr 08
Are there guidelines for grid event management? Anthony (2)

Comments will appear on this page and in the main forum.

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5