Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Losing scope on Multidimensional array in ASP using Javascript


Message #1 by "sara" <fillet70@h...> on Tue, 2 Jul 2002 15:50:23
I have an asp block where i've declared an array.
In another asp block, i'm retrieving data from the database and assigning 
it to the multidimensional array. When i try to access this array in the 
html code beneath the asp block, i get an error that the array is 
undefined. Why am i losing scope on the array ?


<%
var client_array = new Array()
%>
<body>
<form>

<%
// retrieve data from the database and assign it to the recordset oRs
i=0
while (!oRs.EOF)
{
client_array[i] = new Array(oRs(0), oRs(1))
i=i+1
oRs.MoveNext()
}
%>

<SELECT name = "client">
<% for (i=0; i < client_array.length; i++)
{%>
<option value="<%=client_array[i][0]%>" > <%=client_array[i][1]%>
<%
}
%>
</SELECT>

</form>
</body>

  Return to Index