atrum Posted November 6, 2010 Share Posted November 6, 2010 Hello again, Just a quick and hopefully simple question in regards to Objects. Is there a way to get an object to show all of its properties and methods? For an example lets use the form object. How do I get the form object to show all of it's properties and methods? Quote Link to comment https://forums.phpfreaks.com/topic/217942-does-an-oject-dump-exist-in-javascript/ Share on other sites More sharing options...
atrum Posted November 6, 2010 Author Share Posted November 6, 2010 Btw, I just found the list for objects on w3schools. but I am still curious if a object dump exists. Quote Link to comment https://forums.phpfreaks.com/topic/217942-does-an-oject-dump-exist-in-javascript/#findComment-1131100 Share on other sites More sharing options...
.josh Posted November 6, 2010 Share Posted November 6, 2010 no, there is no native var dump for js (yeah I don't understand it either...) but a quick search will reveal plenty of functions that loop through and emulate it easy enough. Quote Link to comment https://forums.phpfreaks.com/topic/217942-does-an-oject-dump-exist-in-javascript/#findComment-1131165 Share on other sites More sharing options...
atrum Posted November 6, 2010 Author Share Posted November 6, 2010 Cool, thanks for the info Quote Link to comment https://forums.phpfreaks.com/topic/217942-does-an-oject-dump-exist-in-javascript/#findComment-1131178 Share on other sites More sharing options...
Adam Posted November 7, 2010 Share Posted November 7, 2010 If you use Firebug, you can view a tree-menu style list of an object, plus it's children and parents, by adding a 'watch expression'. Assuming you have it installed, open it on the page you wish to debug and select the 'Script' tab. In the left panel you'll see the JavaScript for that page, and within in the left margin of that panel, on the line containing a reference to the object, click in the left margin and a red dot should be appear. Run the code again, either by refreshing or calling the event that triggers the code, and in the right panel you should see the object. It's not the most straight-forward tool to use, but it means you don't have to add debug functions or output to find the problem. Quote Link to comment https://forums.phpfreaks.com/topic/217942-does-an-oject-dump-exist-in-javascript/#findComment-1131360 Share on other sites More sharing options...
atrum Posted November 7, 2010 Author Share Posted November 7, 2010 Oh sweet, I never knew about that in firebug. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/217942-does-an-oject-dump-exist-in-javascript/#findComment-1131483 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.