Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Avoid multiple onclick
- From: paul at juniperwebcraft.com (Paul Novitski)
- Subject: [Javascript] Avoid multiple onclick
- Date: Wed Oct 18 04:23:49 2006
At 10/18/2006 01:59 AM, Guillaume wrote:
>So what I'd like is the functions to fire only once even if onclick
>is performed multiple times.
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;
...
}
Regards,
Paul
- Follow-Ups:
- [Javascript] Avoid multiple onclick
- From: Bill Moseley
- [Javascript] Avoid multiple onclick
- References:
- [Javascript] Avoid multiple onclick
- From: Guillaume
- [Javascript] Avoid multiple onclick
- Prev by Date: [Javascript] Avoid multiple onclick
- Next by Date: [Javascript] Check if an element exists in the DOM
- Previous by thread: [Javascript] Avoid multiple onclick
- Next by thread: [Javascript] Avoid multiple onclick
- Index(es):