List All Propeties for an Object

Home

A new window is opened, with a table listing all available properties with values for your object.

  1. Make a new file called props.htm. This file should be completely empty.
  2. Paste the following JavaScript function into your page, or into a JavaScript library file.
  3. Call the function and pass it an object reference - for example props(document.all["myId"])
function props(o) {
  var s = ""
  for (var p in o) {
    s = s + "<tr><td>" + p + "</td><td>" + o[p] + "<td></tr>"
  }
  var b=window.open("props.htm","c","")
  s = "Properties list for the object:<BR><BR><table border='1'>" + s + "</table></body></HTML>"
  s = "<HTML><HEAD><TITLE>Object Properties List</TITLE></HEAD><body>" + s
  b.document.write(s)
}