Link to home
Start Free TrialLog in
Avatar of jazzIIIlove
jazzIIIloveFlag for Sweden

asked on

simple table and default value should come via my array content

Hi;

I have a simple table and in it there are textboxes. I want default values in my array to be appearing in my textboxes by default. Any simple example?

Regards.
ASKER CERTIFIED SOLUTION
Avatar of KNVB HK
KNVB HK
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another example:
<html>
  <head>
    <script language=javascript>
      var myCars=new Array("Saab","Volvo","BMW");
      function loadData()
      {
        var t=document.getElementById("t1");
        for (i=0;i<t.rows.length;i++)
        {
          row=t.rows[i];
          for (j=0;j<row.cells.length;j++)
          {
            cell=row.cells[j];
            textBox=cell.getElementsByTagName('input')[0];
            textBox.value=myCars[i];
          }
        }
      }
    </script>
  </head>
  <body onload="loadData()">
      <table id="t1" border=1>
        <tr>
          <td>
              <input type="text">
          </td>
        </tr>
        <tr>
          <td>
              <input type="text">
          </td>
        </tr>
        <tr>
          <td>
              <input type="text">
          </td>
        </tr>
      </table>
  </body>
</html>    

Open in new window