Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with Arrays

    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:

    Code:
    <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!
    Last edited by Shindere; 03-23-2005 at 03:36 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •