I'm a recent convert to JavaScript and have a potentially simple question. I have a small script which populates an array from records returned from a DB. My question is simply, is it allowable for a server variable to be defined and incremented within JavaScript? I want to do this to increment the array index but the server variable keeps resetting each time a for loop iterates.
answers appreciated.
Bakunin.
function FillArray()
{
var DetailArray = new Array();
var i;
<% dim j
j = 1 %>
for(i=0; i <= document.formDelivery.delivery.length - 1; i++)
{
alert(i);
DetailArray= new Array("<%=var_array(0,j)%>","<%=var_array(1,j)%>"
alert(DetailArray);
alert("j = " + <%=j%>);
<%j = j + 1 %>
alert("j = " + <%=j%>);
}
}
answers appreciated.
Bakunin.
function FillArray()
{
var DetailArray = new Array();
var i;
<% dim j
j = 1 %>
for(i=0; i <= document.formDelivery.delivery.length - 1; i++)
{
alert(i);
DetailArray= new Array("<%=var_array(0,j)%>","<%=var_array(1,j)%>"
alert(DetailArray);
alert("j = " + <%=j%>);
<%j = j + 1 %>
alert("j = " + <%=j%>);
}
}