[Javascript] IE onclick problem
David Dorward
david at dorward.me.uk
Sat Apr 19 07:07:00 CDT 2008
On 19 Apr 2008, at 10:02, Troy III Ajnej wrote:
> > On 19 Apr 2008, at 04:35, Troy III Ajnej wrote:
> > > Sorry, but
> > > > var capturedReturnValue = myFunction();
> > > just won't do! You are asigning the function to the var.
>
> > No, it is the return value of the function.
>
> I think my english is not god enough...,
> you are assigning the function-name (that is: a function call) to
> the "var capturedReturnValue"
No.
var capturedReturnValue = myFunction();
That executes the function and assigns whatever value it returns to
capturedReturnValue.
var referenceToFunction = myFunction;
Without the () to *call* the function it will assign the function to
the variable.
If you couldn't call functions, JavaScript wouldn't be a usable
language.
> All right, -how do you write it so it will return, !not execute
> myFunction(),
> but at least alert you from another function that: myFunction() did
> execute
> succesfully without executing it accidentally on-check time or
> before user-action?
If you want to return a function then:
function myFunction() {
return function () {
var something = doSomething();
doSomethingElse(;
return something;
}
}
--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/
More information about the Javascript
mailing list