I'm assuming the use of jQuery? (It's a good idea to let us know that up front.)
I'm not even sure what you are trying to do here? Why do you have a declaration passed to the jQuery function in the first place? It'll work to establish the function as a ready handler, but it's really really odd.
What is your actual intention?
And to answer the specific question: var is used within non-global scopes to limit the scope of a variable to the current function. Without var, implicitly declared variables will become part of the global scope.
Thanks for the reply, Mr. Bibeault.
Yes, I forgot to mention the use of jQuery.
I am learning Javascript and know that an anonymous function is expected to the the ready handler. I am just curious what it will do if I declare it with a name.
So, the global scope declared function works as a ready handler but a non-global scope declared one doesn't. Can you tell me why? Maybe I can better understand how JavaScript works from finding the answer.