ottus
12-27-2005, 11:10 AM
Hi,
I'm relatively new to JS, but I have some experience with ActionScript. Can anybody explain this to me:
I define a function:
function myFunction () {something.....;}
And then I want to call it by a event handler:
document.onmousemove = myFunction();
it doesn't work. Why?
I know, that the correct syntax would be:
document.onmousemove = myFunction;
WITHOUT ANY PARAMETERS. Why is this correct?
And how is it possible to pass any parameters to my function (if it was pe.: myFunction(someParameter) {blabla.....;}
Thanks for explanation.
Bye, Kozelnik
I'm relatively new to JS, but I have some experience with ActionScript. Can anybody explain this to me:
I define a function:
function myFunction () {something.....;}
And then I want to call it by a event handler:
document.onmousemove = myFunction();
it doesn't work. Why?
I know, that the correct syntax would be:
document.onmousemove = myFunction;
WITHOUT ANY PARAMETERS. Why is this correct?
And how is it possible to pass any parameters to my function (if it was pe.: myFunction(someParameter) {blabla.....;}
Thanks for explanation.
Bye, Kozelnik