Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    202

    Unanswered: Concatenation Problem

    Hi,

    I have this one problem which is keeping me up for nites already.

    I have this javascript at the top of the page which is called by ASP code below (Page=HTML PAGE).

    function update(forNum)
    {
    document.attendance1.test1.value="OP";
    }

    the value test1 is kinda dynamic although wat shown here is static.
    Wat i really wan to do is this test1 can change to test2,test3,..........
    the forNum value is the 1,2,3,.........
    how do i concat the test with the forNum fot the output of test1.
    Thanx

  2. #2
    Join Date
    Feb 2005
    Posts
    4
    Hi, Following is the way to handle this.

    I am using javascript with JSP(u can use asp instead).

    <script>

    var test
    <%int j = 1; %>


    for (j=1; j<=20; j++)
    {
    document.attendance1.test<%=j%>.value="OP";
    }


    </script>


    using this it will generate the jsp with the script as follows

    document.attendance1.test1.value="OP";
    document.attendance1.test2.value="OP";
    ....
    document.attendance1.test20.value="OP";

    Same logic can be used incase you need to do something different.
    Hope this helps.


    ~Mithun.

  3. #3
    Join Date
    Mar 2004
    Posts
    202
    Hi,

    Thanx.............
    it works

Posting Permissions

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