shockuk
04-17-2008, 08:05 AM
Hi all,
I'm a PHP developer who normally tries to avoid Javascript (just haven't had time to learn it tbh, but it's definately on the agenda), and have enountered a problem that might have an easy solution.
Basically, I have a script that returns a name of a currently selected image dd.obj.name and the X coordinate of the current image dd.obj.x
I also have a form with lots of fields which will show the X value of the selected image <form name="xdisplayform"><input type="text" name="X1"><input type="text" name="X2"> (etc...)
Now, I would access this like so: document.xdisplayform.X1.value = dd.obj.x
However, since the script returns the "current" name and X value, I would need something like:
document.xdisplayform.Xdd.obj.name.value = dd.obj.x
But I don't have a clue how to make the variable name out of another variable in Javascript.
Hope that made since and hope someone can help, been searching Google for ages but not quite sure what keywords to search for.
Thanks for your help :)
I'm a PHP developer who normally tries to avoid Javascript (just haven't had time to learn it tbh, but it's definately on the agenda), and have enountered a problem that might have an easy solution.
Basically, I have a script that returns a name of a currently selected image dd.obj.name and the X coordinate of the current image dd.obj.x
I also have a form with lots of fields which will show the X value of the selected image <form name="xdisplayform"><input type="text" name="X1"><input type="text" name="X2"> (etc...)
Now, I would access this like so: document.xdisplayform.X1.value = dd.obj.x
However, since the script returns the "current" name and X value, I would need something like:
document.xdisplayform.Xdd.obj.name.value = dd.obj.x
But I don't have a clue how to make the variable name out of another variable in Javascript.
Hope that made since and hope someone can help, been searching Google for ages but not quite sure what keywords to search for.
Thanks for your help :)
