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 7 of 7
  1. #1
    New Coder
    Join Date
    Jan 2006
    Location
    Oslo, Norway
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Look at all global values?

    Is there any way to look at all global values made from a javascript, without knowing the name of the variables.
    Drømmejenta: Kristen jente som progger Python!

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nope.
    *keep it simple (TM)

  • #3
    New Coder
    Join Date
    Jan 2006
    Location
    Oslo, Norway
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, thanks!

    (Living up to your signature)
    Last edited by jskaar; 06-02-2006 at 02:20 PM.
    Drømmejenta: Kristen jente som progger Python!

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was just thinking an maybe you could loop through the Window object. That might give you a run down of what's there:

    Code:
    for i in window
    {
      sMsg+=i+"\n";
    }
    
    alert(sMsg)
    of course, this is untested, so I may be barking up the wrong tree. one thing it won't do is differeniate variable you declare and those that are part of the DOM.
    *keep it simple (TM)

  • #5
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't think it will work without the parentheses.
    Code:
    var sMsg = '';
    for(i in window)
    {
      sMsg+=i+"\n";
    }
    alert(sMsg);
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

  • #6
    New Coder
    Join Date
    Jan 2006
    Location
    Oslo, Norway
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!

    Made an pretty ugly output, but though
    Drømmejenta: Kristen jente som progger Python!

  • #7
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Just be careful when you use that. Iew in particular has a tendency to break down if you try to access some host objects you can find on the window object. (And elsewhere.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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