[Javascript] Avoid multiple onclick

Guillaume javascript at webdesignofficina.com
Wed Oct 18 03:59:38 CDT 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




More information about the Javascript mailing list