2008/6/1 Peter <[EMAIL PROTECTED]>: > > Hi Mark, > > You don't need to wrap the hover function in an object. Instead you > can use the hover function itself to > store the static variable. In that case you don't need to set > timeoutRunning before the first call > as it is == undefined then. I did a counter: > > function hover2() { > if (!hover2.counter) { > hover2.counter = 1; > $("p").html("1 click"); //write the result somewhere > } > else > { > hover2.counter += 1; > $("p").html(hover2.counter + " clicks"); > } > } > > You can call hover2 without any preliminaries. > > Does the snippett below actually work? I had to replace Hovertest > onmouseover="Hovertest.hover(); by hovertje? > > Cheers, Peter > > On May 31, 9:37 pm, Mark <[EMAIL PROTECTED]> wrote: >> Got it working with this: >> >> function Hovertest() >> { >> this.timeoutRunning = false; >> this.hover = function() >> { >> if (!this.timeoutRunning) >> { >> this.timeoutRunning = true; >> alert('true...'); >> } >> else >> { >> alert('JEAAA FALSE'); >> } >> }} >> >> var hovertje = new Hovertest(); >> >> <a href="#" onmouseover="Hovertest.hover();">hovertest</a> >> >> If there is another way.. please tell me. >
Thanx for that. lol 2 different tests somehow got mixed there.. it needs to be hovertje.