cristianotestai Posted July 22, 2011 Posted July 22, 2011 Hi Farshad, I need to specify an object (UniPanel) concatenating strings in JS. I tried following in run-time, but without success, everything is ok, only the last statement does not work, because he does not understand 'UniPanel+usuid': UniImage1.ClientEvents.ExtEvents.Values ['onclick'] = 'onclick function (sender)' + '{var usuid = Main.UniPanel1.UsuId;' + ' Main.UniPanel1.UsuId =' + IntToStr (UsuId) + ';' + ' Main'. UniImage1.Parent.Name + '. body.applyStyles(' + QuotedStr('background-color: #FDEDE3')+');' ' Main'. + 'UniPanel+usuid' + '. body.applyStyles(' + QuotedStr('background-color: #FDFCFB')+');' '}'; In the last statement, the translation will be for example "Main.UniPanel2.body.apply...", where in this example the value of "usuid" variable = 2. How to perform the concatenation correctly for him to find the object? Tkanks. Quote
Administrators Farshad Mohajeri Posted July 22, 2011 Administrators Posted July 22, 2011 You can not add a number to an object: MainForm.UniPanel+usuid Instead you can use below syntax: MainForm["UniPanel"+usuid].body..... Quote
cristianotestai Posted July 22, 2011 Author Posted July 22, 2011 You can not add a number to an object: MainForm.UniPanel+usuid Instead you can use below syntax: MainForm["UniPanel"+usuid].body..... Tks again.. perfect.. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.