[Javascript] Avoid multiple onclick
Bill Moseley
moseley at hank.org
Wed Oct 18 08:47:01 CDT 2006
On Wed, Oct 18, 2006 at 02:23:16AM -0700, Paul Novitski wrote:
> One method of preventing a function from running more than once is to
> set a global variable the first time the function is called, and
> refuse to run if that variable is set:
>
> var bInitialized = false;
> ...
> function DoSomething()
> {
> if (bInitialized) return;
> bInitialized = true;
>
> ...
> }
Is there a way to do that atomically?
--
Bill Moseley
moseley at hank.org
More information about the Javascript
mailing list