OnReady should fail because the parser created an event handler as the onClick attribute parsed. In this case the click event is being pointed to a non existent (null) function reference.
Represented By this fiddle http://jsfiddle.net/muglio/gzeksLr5/1/ (FAILS)
The second fiddle represents inline javascript in the head tag. In this case the browser would have already parsed and added functionName to the DOM before it reaches the onClick attribute.
Works http://jsfiddle.net/muglio/LoL9Ldzr/1/
If you then took that same script and put it in an external file "functionName.js" and called loaded it in the same place in the head you would create the potential for a race condition.
The script could be loaded before or after the onclick attribute is parsed. No guarantee.
In general you should avoid inline javascript for the same reasons you want to avoid inline css. You should setup the onclick handlers in javascript to avoid coupling your controller and view together.
<script>
//Using jquery here because it is clearly being used in the initial ask :)
$(document).ready(function(){
function functionName() {
}
$('#myButton').on('click',functionName);
});
</script>
html body div table tbody tr td <button id="myButton"></button>
Hope this helps you out.