3 Replies Latest reply on Oct 19, 2009 4:40 AM by erthy

    Variable in a variable? How?

    erthy Level 1

      Hey, I am trying to ask for a part of the XML file, and I want to change the variables I use to do that. In short words, why is my code not working?:

       

       

      var slid = 3;

      var lang = "en";

      var slovicko = slovnikXML.slovicko.(@id == [slid]).@[lang];

      Alert.show("Slovíčko je: " + slovicko);

       

       

      even though this:

       

       

      var slid = 3;

      var lang = "en";

      var slovicko = slovnikXML.slovicko.(@id == 3).@en;

      Alert.show("Slovíčko je: " + slovicko);

       

       

      is working perfectly --> not a problem in the slovnikXML variable.

      this also works:

       

       

      var slid = 3;

      var lang = "en";

      var slovicko = slovnikXML.slovicko.(@id == 3).@[lang];

      Alert.show("Slovíčko je: " + slovicko);

       

       

      So the probelm is somewhere around the @id part...

      Any suggestions?

      Thanks!