This article was first written in May 2005 for the BeezNest technical website (http://glasnost.beeznest.org/articles/257). As of 2008, I don't remember the source exactly, but the links will lead you to them.
document.getElementsBySelector('div#main p a.external')
This will return an array containing all of the links that have ‘external’ in their class attribute and are contained inside a paragraph which is itself contained inside a div with its id attribute set to ‘main’.
So far I’ve only tested it on Phoenix but it seems to work as intended for the small number of test cases I’ve tried. If you spot any bugs please let me know. I’m about to fire up a Windows PC and see how much it breaks in IE…
Update: I’ve put together a demo page showing the function in action. It works fine in IE 6.