slayeroffice - web experiments gone horribly awry

Looking for the drawings? They're over here, and my drawing blog is this way.


  • Current Version: 1.0
  • Last Revision: 02-12-04
  • Language: Javascript
  • Requires: MSIE6, Mozilla, Netscape 7+, Opera 7+, Safari 1.2+

This method acts as an extension to the getElementsBy family of document methods. It takes two arguments: variant "whatever" and boolean "includeTextNodes".

It will loop over the document collection and return an object array of any element it finds that has a tag name, attribute name, attribute value or, optionally, text node that matches the "whatever" argument.

What's that do for you? Well, lets say you want to grab every object on the page that has a title attribute specified. This will do that.

Or, what if you want a reference to every object that contains the phrase "my head hurts"? This will do that as well and is used the exact same was that you would use document.getElementsByName or document.getElementsByTagName.

Hit the "Go" button for a demo page.