If you want to attach more than one event to your element, you will need to use addEventListener. If not, an inline event will do the trick. In terms of speed there won't be a difference. Please note that
element.onclick = function () { alert('1'); };
element.onclick = function () { alert('2'); };
will only alert "2", whilst
element.addEventListener('click', function() {alert('1');}
element.addEventListener('click', function() {alert('2');}
will alert "1" and "2"
as only with addEventListener both events are fired and not overwritten by the later event
element.onclick
as you wrote it is simply the inline javascript
<button onclick=function() ...
written in your script part.
as @Teemu commented, setting onclick property doesn't reflect to the HTML, hence an inline handler is not equal to a property