about listener handers

Posted: 16 May, 2008 in Technical

(function(){
window.onload=function(){
$(‘header’).observe(‘mousedown’, function(){alert(‘a’);});
var input = new Element(‘div’, { id: ‘aaa’, style:’width:50px; height:50px;background-color:black;’ });
input.observe(‘mousedown’, function(e){
alert(‘sss’);
});
$(‘toolbar’).appendChild(input);
$(‘header’).innerHTML += “<br/>”;// It will remove all listeners which is attached by observe function
}
})();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s