In the answers to this question, we read that function f() {} defines the name locally, while [var] f = function() {} defines it globally. That makes p
function f() {}
[var] f = function() {}
var onload = function() { alert("hello"); }
Will declare it locally too.
I suggest you to read this very helpful article : http://kangax.github.io/nfe/