var myElem = document.getElementByID('ElemID'); myElem.onclick = function() { //do stuff }
document.getElementById('button').onclick = function() { alert("button was clicked"); };