I want to create a loop that creates a variable for the number of something selected on a previous page. So if the parameter in vb comes in as 5, I should have 5 variables. I'm essentially writing code that should write code. I used a for loop and eval but no dice. YES I know eval is awful and evil, but the other methods I googled including dot notation and square brackets do not work. Here was my idea that does not work to demonstrate the effect I want:
- Code: Select all
var numProps = <%=numProps%>;
eval("prop" + i) = "testing";
So let's say my initial variable numProps = 5, I should get the variables prop1, prop2, prop3, prop4, prop5 all with a value of "testing".