[uf-discuss] Tutorial on AHAH (such a cool technology!)

Christian Heilmann codepo8 at gmail.com
Tue Feb 13 04:52:42 PST 2007


On 2/13/07, Ara Pehlivanian <ara.pehlivanian at gmail.com> wrote:
> On 2/12/07, Benjamin West <bewest at gmail.com> wrote:
> > Roger,
> > Neat stuff. I thought it was pretty good, but take some issue with the
> > following:
> >
> >   <a href="javascript:ahah('Waldorf-Astoria-Photo.html','Photo');">photo</a>
> >
> > The best practice is to wire the event up, and to use a button when
> > the element is not truly a link.

How is this not a link?

You can link to a template that takes the data as a parameter:

<a href="hotels.php?h=waldorf" id="photo">photo</a>

Then you can use event handling to assign the ahah() function to the
link and hijack the standard behaviour. You could even re-use the
script, add another parameter and get the data back from the same
template in two formats.

This example does that (except for the templating part):
http://beginningjavascript.com/Chapter8/exampleXHR.html

This one even does the templating:
http://beginningjavascript.com/Chapter10/examplePHPXHRgallery.php

This will also make search engines index the detail page. Don't make
things more complicated than they are. Modern scripting allows you to
easily enhance real semantic HTML without having to rely on markup
that only makes sense when scripting is enabled.

cheers
Chris

-- 
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/


More information about the microformats-discuss mailing list