Edit in JSFiddle

<a href='http://z54.com' target='_blank'>AddEventListener Example</a><br>
<input type='submit' value='Event Listeners' id='testListener2'>
function alertEvent()
{
    alert('Event Listener Added');
}
var element=document.getElementById('testListener2');
if(element.addEventListener) 
    element.addEventListener('click', alertEvent , false);
   else if (element.attachEvent) //for IE8 users
     element.attachEvent("onclick", alertEvent);