On 12 jan, 08:14, "Brian Williams" <[EMAIL PROTECTED]> wrote:
> Using Prototype 1.5.1.1 (please don't give me a 'you should upgrade' speech,
> I have my reasons, thanks :) ):
>
> I have a list of links that all have an Ajax.updater being called on a
> mouseover
>
> eg:
> <a href="dosomething.php?pageid=1234" class="info"
> onmouseover="updateDiv();">link to page 1234</a>
> <a href="dosomething.php?pageid=234" class="info"
> onmouseover="updateDiv();">link to page 234</a>
> <a href="dosomething.php?pageid=34" class="info"
> onmouseover="updateDiv();">link to page 34</a>
> <a href="dosomething.php?pageid=4" class="info"
> onmouseover="updateDiv();">link to page 4</a>
> <a href="dosomething.php?pageid=5" class="info"
> onmouseover="updateDiv();">link to page 5</a>
>
> what I want to do is prevent the user from just running their mouse up and
> down the list and creating about 500 ajax calls to pound my server in the
> matter of 10 seconds and limit them to 1 active request or maybe make it so
> that the ajax call won't happen until their mouse has been over the link for
> at least 1 full second.
>
> I was thinking using an Event.Observe($('.info'),'onmouseover',
>
> but thats about where I get lost, I'm not sure how to implement a timer
>
> any help would be appreciated.

I guess it can be done with something like this... haven't tested it
though, so I'm not sure if it does work.
var t;
$$('a.info').invoke('observe', 'mouseover', function(ev) {
  t = updateDiv().delay(1);
});
$$('a.info').invoke('observe', 'mouseout', function(ev) {
  window.clearTimeout(t);
});

Greetz,

Wizz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to