//универсальная функция
function addEvent(element, event, handler) {
if(-[1,]){
return element.addEventListener(event, handler, false);
} else {
return element.attachEvent('on'+event, handler);
}
}
//тестирование
addEvent(document.getElementById('test'), 'click', function(event) {
event = event || window.event;
alert(event);
})
addEvent(document.getElementById('test'), 'click', function(event) {
event = event || window.event;
alert(2);
})