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

Tantek Ç elik tantek at cs.stanford.edu
Tue Feb 13 04:37:57 PST 2007


On 2/13/07 4:30 AM, "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.
>> 
>> Something more like:
>> 
>>   <button 
>> onclick="ahah('Waldorf-Astoria-Photo.html','Photo');">photo</button>
>> 
>> or even better:
>> 
>> <button id="photo_changer" type="button" >photo</button>
>> <script type="text/javascript>
>> // must be done either after onload fires or after the element appears
>> in the DOM...
>> // find the element.
>> photoButton = document.getElementById('photo_changer');
>> // wire up the event.
>> photoButton.onclick = function () {
>>   ahah('Waldorf-Astoria-Photo.html','Photo');
>> };
>> </script>
>> 
>> -Ben
>> 
> 
> Just one thing, <button> isn't a valid HTML tag. You'd be better off
> using <span> (unless you're working with the XML DOM of course).

<button> is a valid HTML4 tag.

http://www.w3.org/TR/html401/interact/forms.html#h-17.5

Tantek



More information about the microformats-discuss mailing list