View Full Version : Problem with Arrays

03-23-2005, 03:13 PM

I just solved my variable concatenation issue, so no worries there. Sorry if anyone was typing up a reply to this thread and I changed what it was about, I appreciate the effort irregardless.

So a new problem has arisen, arrays.

I have a counting/iteration variable, num, that increases everytime a function is called. The coding I am using is as follows:

var num = 0;
var preNum = "<? echo $firstNumber; ?>";
var midNum = "<? echo $midNumber; ?>";
var midNum2 = "<? echo $midNumber2; ?>";
var lastNum = "<? echo $lastNumber; ?>";
cboArray = new Array(20);
txtArray = new Array(20);

function updateElems() {
num += 1;
document.getElementById("GenElems").innerHTML += preNum + num + midNum + num + lastNum + "<p>";

// -->

Basically, anytime I try and call/mention the array in coding, the whole thing stops working, but the syntax doesn't seem wrong. I've tested through a JS alert that the right side's syntax returns the correct value (document.getelementbyid("field"+num).value) ... so it's just using the array that is the issue.

Any help is appreciated! thanks!