Subject: create a variable dynamically in JavaScript
Posted By: crmpicco Post Date: 10/4/2005 5:03:05 AM

var arrival"+s+" = document.forms["form"].elements["arrival"+s].value;


Is there a way to create a variable dynamically in JavaScript?

The above code doesnt work, also tried:


var arrival[s] = document.forms["form"].elements["arrival"+s].value;





www.crmpicco.co.uk
Reply By: vinod_yadav1919 Reply Date: 10/4/2005 5:46:09 AM
Hi Crmpicco!!
 Use eval function.
 Hope this will help you


Cheers :)

vinod
Reply By: joefawcett Reply Date: 10/4/2005 6:14:05 AM
You would normally use an array for this sort of thing.
Why do you need to create a variable dynamically?

--

Joe

Go to topic 35236

Return to index page 460
Return to index page 459
Return to index page 458
Return to index page 457
Return to index page 456
Return to index page 455
Return to index page 454
Return to index page 453
Return to index page 452
Return to index page 451