Help!Help! How to concatenate ...

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

    #1

    Help!Help! How to concatenate ...

    Any experts out there can help to solve the following problem:

    I have the following Javascript expressions:

    temp[0] = document.frmScr 1.txtABC
    temp[1] = document.frmScr 1.txtDEF
    temp[2] = document.frmScr 1.txtHIJ

    And I have created an array to store these values:
    ary["ABC","DEF","HI J"];

    Now, the problem is that is it possible to generate a FOR loop to
    perform the function as above?
    e.g.
    for (count=0; count < 3; count++) {
    temp[count] = document.frmScr 1.txt + ary[count]; // incorrect, guess
    only
    };

    Of course the above code is incorrect, but what should I do or any
    suggestion?

    Many thanks in advance.
    Fed.
  • Lasse Reichstein Nielsen

    #2
    Re: Help!Help! How to concatenate ...

    clubclubboy@yah oo.com.hk (Fed21) writes:
    [color=blue]
    > temp[count] = document.frmScr 1.txt + ary[count]; // incorrect, guess
    > only
    > };
    >
    > Of course the above code is incorrect, but what should I do or any
    > suggestion?[/color]

    <URL:http://jibbering.com/faq/#FAQ4_39>
    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Cycloneous Echevarria

      #3
      Re: Help!Help! How to concatenate ...

      Fed.,

      You have to expose the value property in the
      document.frmScr 1.txtOBJECTNAME objects

      var temp = new Array();
      var ary["ABC","DEF","HI J"];

      temp[0] = document.frmScr 1.txtABC.value;
      temp[1] = document.frmScr 1.txtDEF.value;
      temp[2] = document.frmScr 1.txtHIJ.value;

      for (count=0; count < 3; count++) {
      temp[count] = temp[count] + ary[count];
      }


      Fed21 wrote:[color=blue]
      > Any experts out there can help to solve the following problem:
      >
      > I have the following Javascript expressions:
      >
      > temp[0] = document.frmScr 1.txtABC
      > temp[1] = document.frmScr 1.txtDEF
      > temp[2] = document.frmScr 1.txtHIJ
      >
      > And I have created an array to store these values:
      > ary["ABC","DEF","HI J"];
      >
      > Now, the problem is that is it possible to generate a FOR loop to
      > perform the function as above?
      > e.g.
      > for (count=0; count < 3; count++) {
      > temp[count] = document.frmScr 1.txt + ary[count]; // incorrect, guess
      > only
      > };
      >
      > Of course the above code is incorrect, but what should I do or any
      > suggestion?
      >
      > Many thanks in advance.
      > Fed.[/color]

      Comment

      Working...