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

James Craig jcraig at apple.com
Tue Feb 13 16:12:57 PST 2007


Benjamin West wrote:

>> > >   <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>
>
> The difference, of course, is the first example doesn't have a URI.
> Your example does have a URI.  If clicking on an anchor element won't
> ever take you to a new page (because there is no URI), don't use the
> anchor element!

I disagree. You should be practicing accessible, progressive  
enhancement. The first example does have a URI, it's the relative  
path to Waldorf-Astoria-Photo.html and should be set up to work from  
a spider, script disabled browser, or even a "right-click to open  
link in new tab." Your practice of wiring javascript to a button is  
effectively hijacking the user's browser will do nothing except  
ensure the content is inaccessible to all but a few targeted user  
agents.

<a href="Waldorf-Astoria-Photo.html" class="ahah-photo">photo</a>

Works as a regular link and–once the right event handlers are  
assigned–will work as a JS-enhanced interface.

James




More information about the microformats-discuss mailing list