More unobtrusive DHTML
I’ve talked about unobtrusive DHTML before, and here’s a superb example of it in practise from Chris Casciano. His zeitgeist is enhanced by some clever javascript which hides and reveals tables of data when certain page elements are clicked. View source, and you’ll see that the document contains only structural HTML, with no embedded javascript at all. The special behaviour is added by an external Javascript file which adds the necessary event handlers when it loads, based on the structure of the existing document. This approach maintains the usability of the information in a non-javascript supporting environment, while seriously enhancing the maintainaility of the page as new structural elements can be added to the HTML which will pick up the special behaviour without any further modification to the javascript needed.
Martijn - 2nd July 2003 23:31 - #
Mike Kozlowski - 3rd July 2003 18:33 - #
Thanks for the link and kind words Simon!
The report itself is a work in progress, basically a front end for an old log parsing script I've carried around with me over the years. One of the things I've thought about doing, to answer your question Martijn, is to move a lot of the css definitions into the JavaScript to better separate the stages in which the page displays - for example not usni display:none in the style sheet but start with everything open and then collapse things and rearrange as needed as the JS inits.
Problem there is (a) many users with JS enabled will see some very odd flashes of content going everywhere and more importantly (b) I just don't have the time to code and debug all that for this one page on my personal site.
As to the standards aspect of it I'm sure you can use addEventListener (DOM2 Events???) if that'll make you happier, using onclick is just what I'm used to doing.
Chris - 6th July 2003 04:22 - #
Martijn - 6th July 2003 08:48 - #