Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Avoid multiple onclick


  • From: javascript at webdesignofficina.com (Guillaume)
  • Subject: [Javascript] Avoid multiple onclick
  • Date: Wed Oct 18 04:00:21 2006

Hi there,

I'm using onclick events to fire some functions. Such as:

var oncL2 = document.getElementById('shOptNav');

oncL2.onclick = function() {checkOptSliD(); clearMt()};



Trouble comes when a user clicks several times, the functions are fired 
each time, added to each other...
This is an issue since I'm using some loops to check some elements 
dimensions. These loops are then added into memory each time the onclick 
event fires causing memory overload...

So what I'd like is the functions to fire only once even if onclick is 
performed multiple times.

How do I do that ?

Thanks.

Guillaume