A function declaration creates a variable pointing to the function in the current scope.
In JavaScript, each function creates a new scope.
You are creating function inside the scope of the anonymous function you assign to callme. It is not a global.
The onclick event handler is not in the scope of the aforementioned anonymous function, so the variable is not accessible.
Please try something like this example...
function callMe(){
alert("Inside the function");
this.value = "New Value";
}
window.onload = function(){
callMe();
document.getElementById("thisCall").onclick = callMe;
}
EDIT:
And this code :
document.getElementById("thisCall").onclick = callMe;
Is working because it's written inside the onload function scope, where the function callMe is defined.
And it will not work if you use it with the onclick attribute, because like said callMe()isn't recognized in the global scope and that's the reason why you got callMe is not defined there.
Hope this helps.. Let me know :)