How to use bindAsEventListener to realize mouse click counter? The test code is as following: ////////////////////////////////////////////// function counter(){ } counter.counter1 = 1; // above is the static counter
function wraphandler(e) { var tag = Event.element(e).tagName.toLowerCase(); var data = $A(arguments); data.shift(); document.writeln(this.name + 'Click on a ' + tag + '\nOther args: ' + data.join(', ') + '</br>'); counter.counter1 = counter.counter1 + 1; document.writeln('counter1 = ' + counter.counter1.toString() + '</ br>'); } Event.observe(document.body, 'click', wraphandler.bindAsEventListener (obj, 1, 2, 3)); ////////////////////////////////////////////// I hope that each time I click the body, the displayed counter1 increase 1. But the displayed counter1 doesn't change. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---