Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    44
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question How to show a object method and attribute?

    I call a object,it owns many methods and attributes. For example,a object named obj,it owns following method:
    getId(),getName(),....

    I want to know if there is a way which to show its all methods and attributes? If could,how to do it with javascript?

    Anyidea will be appreciated!

  • #2
    Regular Coder
    Join Date
    Jun 2007
    Location
    USA
    Posts
    527
    Thanks
    26
    Thanked 74 Times in 72 Posts
    Code:
    for(var x in obj)
      alert("Property:" + x + "\nValue:" + obj[x]);
    Trinithis


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •