Standard code for the first and third examples, for comparison:
<button onclick="this.classList.toggle('clicked')"> Toggle the "clicked" class on me </button>
<div onclick="aJavascriptFunction(), setTimeout(anotherJavascriptFunction, 10000)"> Do some stuff </div>
The second example (triggering mouseover on #foo) cannot be that easily inlined in an HTML attribute. I think you’d have to create a synthetic event and dispatch it.