alex_read
Jan 3rd, 2002, 10:41 AM
Function CreateInitialArray() {
var intCounter;
var strTemp;
for(intCounter=0; intCounter<theform.lstbox.options.length; intCounter++) {
strAry[intCounter] = theform.lstbox.options[intCounter].text;
strTemp = strTemp + strAry[intCounter] + "\n";
}
alert(strTemp);
}
Hi all. I'm using that one to loop through a <Select> listbox on a web page, and adding each line or entry from this listbox into an array. A string's then created of all the array elements before showing this in a messagebox.
I keep getting "undefined" before the first entry though - below is an example of how this comes out. Whats the reasoning behind this please ?!?!? :confused: :
UndefinedOne
Two
Three
var intCounter;
var strTemp;
for(intCounter=0; intCounter<theform.lstbox.options.length; intCounter++) {
strAry[intCounter] = theform.lstbox.options[intCounter].text;
strTemp = strTemp + strAry[intCounter] + "\n";
}
alert(strTemp);
}
Hi all. I'm using that one to loop through a <Select> listbox on a web page, and adding each line or entry from this listbox into an array. A string's then created of all the array elements before showing this in a messagebox.
I keep getting "undefined" before the first entry though - below is an example of how this comes out. Whats the reasoning behind this please ?!?!? :confused: :
UndefinedOne
Two
Three