Re: capuring links or other events
- Hello Martin:
You're right! You can bobble up the events for the DIV... and manage
every event as you like...
All you need is to use the Custom Event Object
(YAHOO.util.CustomEvent), and then subscribe the corresponding
function to management the click over your dynamic links...
As you can see in this under construction website ;-):
All the events are bobble up using this technique. Note that you maybe
use external links inside the DIV, and then you need to analyze the
target of the event to determine if the anchor is internal or external
link. Also you need to keep in mind that the target of this:
Is the IMG element, not the anchor, then you need to find the correct
target (anchor) before analyze it. All this stuff may are confused,
but when you see it clearly, then you will see a new world for
If you need more details, just ask ;-)
> I have a simple page that loads content via ajax into a region (div)
> page. The content of that region has tons of links in it. All theselinks
> will do is load more content into the same region.replaces
> I can attach an event to all the links to call a function that then
> the content of the region when clicked.way I can
> However, I'm wondering if there is a way that I can do the same thing
> without attaching the same event to every link. Instead is there a
> catch the click somehow? Does it bubble up before the browserrefreshes and
> can it be caught? I would also need the link so I can pull the hreffrom it.
> I know about the onUnLoad event, but I don't know how I could figure out
> from there which element 'unloaded' unloaded the document.
> Hope this makes sense. Thanks in advance...martin