I actually was thinking something like this, but didn't think that the
'this' object would get assigned to the link.

I'll give it a go.

On Jan 22, 12:17 pm, Matt Sargent <[email protected]> wrote:
> Add a custom attribute to each of the links:
> link1.setAttribute('seq', 1);
>
> then retrieve it in the function using "this" to point to the calling
> link without having to know which link it was, thus:
> var seqval = this.getAttribute('seq');
>
> On 1/22/2011 10:46 AM, Mike Soh wrote:
>
> > Because you can't just simply type<a onclick="coolstuff()">, you have
> > to use the trick mentioned here:
> >http://www.oreillynet.com/pub/a/network/2005/11/01/avoid-common-greas...
>
> > But what the page doesn't cover is how to create an event handler but
> > also set up arguments.
>
> > For example, if I want to be able to assign each link with a different
> > number and do something cool based on that number, I would have to
> > assign each link with it's own function.
>
> > Is there a way to create an event handler and provide it arguments to
> > pass to the function being called?
>
> > Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" 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/greasemonkey-users?hl=en.

Reply via email to