The onXyz convention you are talking about relates to the very old paradigm of setting up events either via HTML event attributes (as in your examples) or via properties of DOM objects in JavaScript (i.e. window.onload = ...). Both techniques have serious drawbacks and neither should continue to be used (use .addEventListener() instead).** In fact, event names themselves never actually start with on. For example, the click event is called click, not onclick, the on was meant to indicate what you wanted to do when click occurs. But, these two out of date techniques are unique to event registrations and not functions/methods in general, so the on paradigm isn't something you should worry about.
There are naming conventions for functions and methods:
- They should have verb-like names to indicate that they perform a
behavior/task (whereas data properties should have noun-like names to
indicate the information they store).
- If the function is meant to be called as a function or as a method of
an object, it should be written in "camel case" (where the first word
is all lower-case, but any/all additional words begin with a capital
letter (i.e.
doSomethingCool).
- If the function is to act as a constructor function (to be invoked
with the
new operator to create a new instance of an object), it
should be written in "pascal case" (where each word starts with a
capital letter). This convention alerts other developers that they should be calling the function with the new operator.