sandravega
Programmer
Hi
I'm just trying to accomplish this:
I use asp to recover information from a table into an array.
I use asp because I want it in the server side... where the database is(uh, that's right, isn't it?I'm not sure)
Then I need to pass this array to an client-side function, just to repopulate a <select>. But the code says that something wrong with the array, it can't recognize it nor in vbscript nor in Javascript
I have some button like=
<input type="button" onClick="Repopulate(<%=myarray%>)" value="Repopulate Now!">
and a JavaScript function like
<script language="javascript">
function Repopulate(myarray)
var i;
objSel = document.frm1.myselect;
objSel.options.length = 0;
for (i = 0; i < myarray.length; i++)
{
var obj = new Option();
obj.value = myarray;
obj.text = myarray;
objSel.options[objSel.options.length] = obj;
}
objSel.options[0].selected = true;
end function
</script>
I know the js function does not work, it just don`t recognizes de array.
I asked this in both forums, the javascript and here...
Thank you a lot
Sandra
I'm just trying to accomplish this:
I use asp to recover information from a table into an array.
I use asp because I want it in the server side... where the database is(uh, that's right, isn't it?I'm not sure)
Then I need to pass this array to an client-side function, just to repopulate a <select>. But the code says that something wrong with the array, it can't recognize it nor in vbscript nor in Javascript
I have some button like=
<input type="button" onClick="Repopulate(<%=myarray%>)" value="Repopulate Now!">
and a JavaScript function like
<script language="javascript">
function Repopulate(myarray)
var i;
objSel = document.frm1.myselect;
objSel.options.length = 0;
for (i = 0; i < myarray.length; i++)
{
var obj = new Option();
obj.value = myarray;
obj.text = myarray;
objSel.options[objSel.options.length] = obj;
}
objSel.options[0].selected = true;
end function
</script>
I know the js function does not work, it just don`t recognizes de array.
I asked this in both forums, the javascript and here...
Thank you a lot
Sandra