Loading ...
Sorry, an error occurred while loading the content.

Re: capuring links or other events

Expand Messages
  • Caridy Patiño Mayea
    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
    Message 1 of 4 , Jan 30, 2007
    • 0 Attachment
      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 ;-):
      http://www.b2vip.com/esp/centro-de-negocio

      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:

      <a><img /></a>

      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
      javascript´s code.

      If you need more details, just ask ;-)

      regards
      Caridy

      --- In ydn-javascript@yahoogroups.com, "Martin Tschofen"
      <martin.tschofen@...> wrote:
      >
      > I have a simple page that loads content via ajax into a region (div)
      on the
      > page. The content of that region has tons of links in it. All these
      links
      > will do is load more content into the same region.
      > I can attach an event to all the links to call a function that then
      replaces
      > the content of the region when clicked.
      >
      > 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
      way I can
      > catch the click somehow? Does it bubble up before the browser
      refreshes and
      > can it be caught? I would also need the link so I can pull the href
      from 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
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.