I would like to know if someone knows how to make a function repeat over and over while the mouse is press, I don't know how to make it work. I know in prototype you can take events like
$('id').observe("click",function(event){})
$('id').observe("leave",function(event){})
$('id').observe("change",function(event){})
//etc...
but is something like $('id').observe("whilemousepress",function(event){})
:P
//I know there is not any event in Javascript but I would like to emulate.
I can't comment on the prototype specifics, but you could probably do this by creating an interval using setInterval()
that is started on mousedown
and is stopped using .clearInterval()
on mouseup
.