steveclaflin.com

ObjectExaminer.js
Beta Version 0.82

A JavaScript tool that displays properties of JavaScript objects.

Developed and Copyright © 2004 - 2007 by Steve Claflin


Currently freeware--licensed freely for use on your own system, but not for distribution to others.

The script has been tested in IE5+ and Firefox 1.5 with Windows 98 and Windows XP. I still consider this a beta release, pending further testing.

Version 0.82 fixed an issue in Firefox that one specific element is unexaminable - there may be other unexaminable elements that I haven't found yet.

ObjectExaminer is intended to be used in debugging JavaScript in web pages and for general exploring of the Document Object Model for a given web browser. It displays a table of the object's array elements and properties. Any item that is itself an object is hyperlinked so that it may be examined. You can get an example of how it works by clicking one of the following links:


To download: ObjectExaminer.zip (contains the js file and this page).

To use it:

  1. Store it the same directory as the html file you wish to use it with (or store it anywhere else and use a path to it in the next step).
  2. Add the following line in the head section of your document:
  3. At the point in your script code where you would like to see the properties of an object add:

User Settable Variables

There are a number of variables you can set to customize the program (and/or thwart various browser inadequacies):

VariableAssigned ValueComments
arrayColor'FFFFEE' background color of Array Elements area
arrayStyle'background-color:' + arrayColor + ';'syle string for Array Elements area - customize this as you wish
propsColor'FFEEEE' background color of Properties area
propsStyle'background-color:' + propsColor + ';' style string for Properties area - customize this with whatever style properties you might want
cellPadding3hopefully self-explanatory
fontSize'10pt'used in style section for td elements
useStyletrueuse styles (see testNS4Style below)
useBgfalseuse bgColor instead of styles (you should not set both true, but could set both false)
testNS4Styletrueturns on test that sets useStyle false and useBg true in NS4 (NS4 seems to have problems with document.write and styles)
NS4DocCloseDelay1000 delay time between document.write and document.close/finish up properties needed by window- apparently needed by NS4 (multi-window threading issue?)
wTop0base location of popup windows
wLeft0base location of popup windows
cascade20amount by which to offset child window
wShrinkW32 popup width = screen width - wShrinkW - accumulated cascade
wShrinkH48 popup height = screen height - wShrinkH - accumulated cascade
doSorttrue enables sorting of props list - setting false will speed things up in some browsers
skipBadHrefstrueworks around a NS6 bug that hangs up on host, hostname, and search with certain protocols - set to false if your browser does not exhibit this problem
legalHrefs'http https news ftp file gopher' space-delimited string of non-problematic protocols

Give it a try--I'd be interested in any feedback or suggestions you might have.