If I want a function to be executed, I prefer doing inline js:
Click me
becaus
Apart from the coding standards perspective
Using Attributes:
Click me
if you add the same attribute again (see below) -the latest one is considered.
Click me
Using Event Handler:
document.getElementById('element').onclick = doSomething;
and lets say you added the below line
document.getElementById('element').onclick = doSomethingMore;
Both the handlers are invoked.