Archive for the 'DHTML' Category

Progressive Enhancement

Thursday, September 25th, 2008

One of the things I was doing while working for the College Board was researching strategies for accessible Web content. So it became apparent that Pragmatic Progressive Enhancement, or what we used to call Graceful Degradation, was in fact the best architectural strategy for ensuring an accessible and robust user experience.

(more…)

Firefox Extensions

Thursday, August 14th, 2008

Lately I have been fielding a lot of questions at work about strategies for assuring that the markup is semantic, accessible and valid. I recently compiled a short list of Firefox extensions that test whether XHTML is standards-compliant.

(more…)

Neat little example of a useful Javascript closure

Sunday, May 6th, 2007

Closures are a powerful feature of JavaScript. However it’s often hard to explain in a few words, just what is useful about closures. Well, here on page 131 of the Rhino book, is the recipe for a unique ID generator that doesn’t require a global counter.

One thing that I personally enjoy about the Flanagan book is that he says things like “don’t pollute the global namespace.” :) This technique does not pollute the global namespace.

var uid = (
function(){
var id=0;
return function(){
return id++ ;
};
}
)();
//then just say:
alert(uid());


Neat little example of a useful JavaScript closure

Monday, September 11th, 2006

I just picked up the 5th edition of David Flanagan’s JavaScript, the Definitive Guide. I find it amusing that that book is the only JavaScript book officially recommended at comp.lang.javascript.

Closures are a powerful feature of JavaScript. However it’s often hard to explain in a few words, just what is useful about closures. Well, here on page 131 of the Rhino book, is the recipe for a unique ID generator that doesn’t require a global counter.

One thing that I personally enjoy about the Flanagan book is that he says things like “don’t pollute the global namespace.” :) This technique does not pollute the global namespace.

var uid = (
  function(){
    var id=0;
    return function(){
      return id++ ;
    };
  }
)();
//then just say:
alert(uid());

var uid = (function(){var id=0; return function(){return id++ ;};})();

Hover Detail

Sunday, June 11th, 2006

Tonight I added a hover detail to the Flickr thumbnails on the right. If you mouse over a thumbnail, you can see a large version of the photo. If you click on the large photo, its Flickr page loads in a new window.

I’m using the MTFlickrPhotos plugin to generate thumbnails, and to write the HTML for the large images into a hidden DIV. I’d like to load the large images asnchronously, but I need to work out how to request images. So far I’ve just used Ajax.Updater to preload HTML.

Oh yes, did I mention that the hover details are completely hosed in IE?

Explicitly Trigger A JavaScript Event Handler

Wednesday, June 7th, 2006


<script type="text/javascript">
function foo(){ alert("Hello World") }
</script>
<div id="bar" onclick="foo();">click me to see an alert</div>
<div onclick = "document.getElementById('bar').onclick()" > click me to do the same thing </div>

This is trivial, but the subject came up at work today; and I wound up making a little demo, which I’ll now post.

Explicitly Trigger An Event Handler in JavaScript

Position an element above the fold dynamically with JavaScript

Monday, June 5th, 2006

I put together some JavaScript to keep an element above the fold.

This was written at the last minute for the Barney’s New York launch; to spruce up the admin tool for their new web site. I only had time to test it in IE6 and Firefox 1.x, but I believe it works in Safari as well. Additionally, I do know that this bit of code has been in use internally at Barney’s for a few months now without any complaints coming back. So it may work well on older browsers too; although I believe there are compatibility issues with document.body.clientHeight in some browsers.

(more…)