I would like to know how to solve the following problem:
I have an array - in asp classic
objArray
And I am using this in loop in javascript. The problem is how I can access the individual elements in the asp-array when I am in the javascript code, and using a variable for it. In Javascript I can easily get an individal element from the asp-array if I use an integer, for instance:
var theString = '<%=objArray[3]%>';
That is the element in the 4'th position.
But - int the loop in javascript - i need to use the variable 'i' to get the elements - but how can I do that since its asp? See the code below.
<script type="text/javascript">
var arrayLen = '<%=nObjects%>'
for (var i = 0; i < arrayLen; i++) {
var y = document.createElement("label");
y.innerHTML = '<%=objArray(i)%>'; // this doesnt work since asp doesnt recognice the variable i
document.body.appendChild(y);
}
</script>