dynamic for loop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ziemon

    dynamic for loop

    i have this :


    for (i = 0; i < test.length; i++)
    {
    document.write( "#" + test[i].number + test[i].name + test[i].height +
    test[i].position + test[i].college + "<br>")
    }


    my question is how can i make 'test' dynamic ? so that i can specify for
    example through a form which array (the name) it should be?

    tnx


  • Evertjan.

    #2
    Re: dynamic for loop

    ziemon wrote on 07 sep 2003 in comp.lang.javas cript:[color=blue]
    > for (i = 0; i < test.length; i++)
    > {
    > document.write( "#" + test[i].number + test[i].name + test[i].height +
    > test[i].position + test[i].college + "<br>")
    > }
    >
    > my question is how can i make 'test' dynamic ? so that i can specify
    > for example through a form which array (the name) it should be?[/color]

    <script>
    function writest(x) {
    for (i = 0; i < x.length; i++) {
    t = "#" + x[i].number + x[i].name
    t += x[i].height + x[i].position
    t += x[i].college + "<br>"
    document.writel n(t)
    }
    }

    writest(test1)
    writest(test2)

    </script>

    not writested


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    Working...