JS Problem

    Date: 06/09/07 (PHP Community)    Keywords: php, java

    I'm having trouble pulling dynamic data from an array in JavaScript. Now I know in PHP you can use curly braces to escape a variable name, so you can have ${$other_var}, and I am sure that something similar exists for JavaScript, I just can't seem to find it.

    So I've got my JavaScript array (placed at the bottom of my page).
        Restoration[1]["Revive"] = new Array("9", "../images/icons/revive.jpg", "Revive", "1", "Spell brings back Dead as Recruits. Targets a single unit type. Revives 1000 to 2000 dead. Costs 100 mana.", "0", "2");

    My function that's supposed to be pulling the array:
        function skill_details(tree, pos, skill)
        {
            var id = tree[pos][skill][0];
            alert(id);
        }


    And the call to the function, with the pointers to the proper array, and sub-dimension.
        skill_details('Restoration', '1', 'Revive');

    Any help? I'm pretty sure that there's sometime similar to ${$other_var} for JavaScript, if not, what can I do?

    Thanks for the help.

    Source: http://community.livejournal.com/php/570332.html

« HELP - problem finding errors || Problem with checkboxes »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home