Just to wrap this up, here's what worked:

        var details = function(evt){
                Event.stop(evt);
                var elm = Event.element(evt);
                alert(elm);
        }
        $$('a.more').invoke('observe','click',details.bindAsEventListener 
('evt'));

Thanks again for setting me on the right track.

Walter

On Mar 6, 2008, at 11:59 AM, Elden wrote:

> try this.
>
> $$('a.more').invoke("observe","click",blah.bindAsEventListener(this));
>
> function blah(event){
>        //this function would do way more than this
>        event.stop();
>        alert ("blah");
> }
>
> and for more information take a look on the api doc's
>
> http://www.prototypejs.org/api/function/bind
>
> http://www.prototypejs.org/api/function/bindAsEventListener
>
> On Thu, Mar 6, 2008 at 10:41 AM, Walter Lee Davis  
> <[EMAIL PROTECTED]> wrote:
>
> I have a set of A tags that I would like to watch unobtrusively. I
> have given them all the same classname, and I want to use invoke to
> set them up, rather than each. Am I trying to do something that won't
> work?
>
> var blah = function(){
>        //this function would do way more than this
>        alert (this);
> }
>
> $$('a.more').invoke('observe','click',blah);
>
> This works fine, but I want to stop the event, and none of these do
> the trick:
>
> this.stop()
> Event.stop(this)
>
> or even extending the invoke with an additional argument after blah
> and using that as the event.
>
> $$('a.more').invoke('observe','click',blah,'evt');
>
> The only way I have been able to hack it to actually do what I want
> is to set this.href to null. Which feels wrong in many ways.
>
> What's the right way to do this -- unobtrusively setting these links
> to not work, yet leaving them alone for those who don't have JS
> enabled? Can I do this with invoke or do I need to get out and push
> with each?
>
> Thanks in advance,
>
> Walter
>
>
>
>
>
> -- 
> {a human being that was given to fly}
> >


--~--~---------~--~----~------------~-------~--~----~
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