Eventos onclick JavaScript

window.onload = function(){
  testarEvento = function(){
    alert("Evento Funcionou!");
  }

  // DOM 0
  var teste01 = document.getElementById("teste01");
  teste01.onclick = function(){
    testarEvento();
  }

  // DOM 2
  var teste02 = document.getElementById("teste02");
  teste02.addEventListener("click",testarEvento,false);
}

Comentar este artigo: