adding a debug alert function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cainnech
    New Member
    • Nov 2007
    • 132

    adding a debug alert function

    Hi,

    I'm working on a script and for debugging I want to check what values are in my array.

    Now instead of putting alerts everywhere in the code I wanted to put an inputbox with an alertbutton. This way if I want to see what's in the array, I could just type in for example: items[1].name and press the alert button and I would get an alert-button saying what the name is.

    So far for theory.

    So what I'm trying to do is alert(items[i].name) but where I can fill in what I want to see.

    Right now when I type in item[i].name and press the alertbutton, I get an alert saying item[i].name where I actually want to see what's in items[1].name

    I know it's gonna be something simple but for a very peculiar reason I can build scripts that can perform the most challenging tasks but I always get stuck on those little stupid things and that's when I turn to the real experts :-)
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You can use the window object, e.g. window[val] where val would be the name input into the text box.

    Comment

    Working...