Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Avoid multiple onclick
- From: moseley at hank.org (Bill Moseley)
- Subject: [Javascript] Avoid multiple onclick
- Date: Wed Oct 18 08:48:51 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@xxxxxxxx
- Follow-Ups:
- [Javascript] Avoid multiple onclick
- From: Nick Fitzsimons
- [Javascript] Avoid multiple onclick
- References:
- [Javascript] Avoid multiple onclick
- From: Guillaume
- [Javascript] Avoid multiple onclick
- From: Paul Novitski
- [Javascript] Avoid multiple onclick
- Prev by Date: [Javascript] Check if an element exists in the DOM
- Next by Date: [Javascript] Avoid multiple onclick
- Previous by thread: [Javascript] Avoid multiple onclick
- Next by thread: [Javascript] Avoid multiple onclick
- Index(es):