Tuesday, January 6, 2009

Undocumented Object Properties

I was inspired to write this post because I tried a lot to find this out. During debugging I needed it badly. There are many undocumented properties, that you can’t just alert. Sometimes, even you are in need of finding out a property/attribute of the object that accomplish your need. The code snippet below will list all the properties of any object with type. I’m sure this will be quite helpful to others too.

function ListAttributes(obj,debuggerId){

var result = "";
for (var i in obj)

result += "obj." + i + " = " + obj[i] + "";


document.getElementById(debuggerId).innerHTML=result;



}

Parameter List:

Obj = object to be reviewed
debuggerId = Id of the div or any other element, insider which you need to write the complete list of all attributes

No comments:

Post a Comment