Accepting an array as function return value

wxdqz

New Member
Hi!

I am trying to read the contents of an array into a HTML listbox and am encountering problems.

First I created a COM object in VB with specific functions I need. One of these functions returns an array with which I would like to fill an HTML listbox in an asp page. I am retrieving the array by mouse click on a button in the asp page, therefor I have written a function in Javascript.

<script language="javascript">
function GetTaglist()
{
var f2 = document.forms("TagSearch");

var COMTag = new ActiveXObject("xIMSRG.clsPIData");
var taglist = new Array();
taglist = COMTag.GetTagList("T01037","cd*");

for(var i=0; i<taglist.length; i++)
{
var opt = document.createElement("OPTION");
opt.text = taglist;
opt.value = taglist;
f2.searchlist.add(opt);
}
}
</script>

I assign the returned array to my array taglist but when checking this variable it appears to be "undefined". It seems I cannot catch the returned array correctly.

Does anyone know how to accept a returned array in Javascript?

Many thanks!

JKJ
 
Back
Top