hi, The for(var in obj) loop can enumerate most (if not all) properties of a given obj, but how to differentiate whixh are the fields and which are the methods. Are there predefined functions that can do that?
posted 11 years ago
Well, it depends on a browser. I tried your code in IE6 and firefox.
if you run the code you posted in IE, methods wil not be returned, but event handlers are. For them typeof(window.document[property]) will be "object" if they are not set and "function" if they are set. You can filter them out since they always start with "on".
In firefox, event handlers will not be returned, but methods are. typeof(window.document[property]) will be "function" for those methods. [ December 07, 2005: Message edited by: Yuriy Fuksenko ]
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads