If I want a function to be executed, I prefer doing inline js:
Click me
becaus
I'm not aware of and advantage of using inline handler vs attach the handler later. In my experience I prefer to use the inline method when I have to deal with dynamic elements, for example if I want to add an handler to each image and the number of images changes according to other data (ex images in db). In this case using inline allow me to add an handler to each image, otherwise i have to recalculate the number of images in the javascript file to attach and handler to each image.
Of course, when you can use libraries like jQuery where you can easily get the list of elements inline aren't useful