...

View Full Version : Problem with Arrays



Shindere
03-23-2005, 02:13 PM
Greetings-

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:



<SCRIPT LANGUAGE="JavaScript">
<!--
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;
cboArray[num]=document.getElementById("Field"+num).value;
txtArray[num]=document.getElementById("Field"+num+"_txt").value;
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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum