Revision: 636
Updated Code
at September 21, 2006 12:15 by Roshambo
Updated Code
// Cross-browser implementation of element.addEventListener()
function addListener(element, type, expression, bubbling)
{
bubbling = bubbling || false;
if(window.addEventListener) { // Standard
element.addEventListener(type, expression, bubbling);
return true;
} else if(window.attachEvent) { // IE
element.attachEvent('on' + type, expression);
return true;
} else return false;
}
Revision: 635
Updated Code
at July 23, 2006 17:26 by Roshambo
Updated Code
function addListener(element, type, expression, bubbling)
{
bubbling = bubbling || false;
if(window.addEventListener) { // Standard
element.addEventListener(type, expression, bubbling);
return true;
} else if(window.attachEvent) { // IE
element.attachEvent('on' + type, expression);
return true;
} else return false;
}
Revision: 634
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 23, 2006 12:54 by Roshambo
Initial Code
function addListener(obj, type, expression, bubbling)
{
bubbling = bubbling || false;
if(window.addEventListener) { // Standard
obj.addEventListener(type, expression, bubbling);
return true;
} else if(window.attachEvent) { // IE
obj.attachEvent('on' + type, expression);
return true;
} else return false;
}
Initial URL
Initial Description
Cross-browser implementation of element.addEventListener(). Simple, straightforward, and functional. Useage: addListener(window, 'load', myFunction);
Initial Title
Add Event Listener
Initial Tags
Initial Language
JavaScript