Sascha321: Dynamisch namen zuweisen

Beitrag lesen

Hallo

das ist also der Code nun weiß ich leider nicht wie ich den dynamisch erstellten Textfelder die Werte abfragen soll.Die ich dan später in einer Datenbank speichern möchte.

<html>
<head>

<script type="text/javascript">

var breite = new Array("6","16","10","5","5","5","5","5","5");
    var anzahl = new Array("8","16","11","7","7","7","7","7","7");
    var buendig =new Array("ltr","ltr","ltr","rtl","rtl","rtl","rtl","rtl","rtl");
  function addRowToTable()
  {
       var tbl = document.getElementById('Tabelle');
       var lastRow = tbl.rows.length;
       var iteration = lastRow;
       var row = tbl.insertRow();
       var cell1 = row.insertCell();
       cell1.className = "cell02g";
       var newText = document.createElement("input");
       newText.setAttribute("type","text");
       newText.setAttribute("size","1");
       newText.setAttribute("align","center");
       newText.setAttribute("value",iteration);
       newText.maxLength = 2;
       cell1.appendChild(newText);

for(i=0;i<breite.length;i++)
     {
       var cell1 = row.insertCell();
       cell1.className = "cell02g";
       var newText = document.createElement("input");
       newText.setAttribute("type","text");
       newText.setAttribute("size",breite[i]);
       newText.setAttribute("dir",buendig[i]);
       newText.maxLength = anzahl[i];
       cell1.appendChild(newText);
     }
  }
</script>
</head>
  <title></title>
  <link href="style.css" rel="stylesheet" type="text/css" media="all" />
  <body >
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#666666">
  <tr>
    <td width="80"></td>
    <td style="background-image:url(images/test.jpg)" align="left" height="70" valign="top" ><img src="images/head.gif" alt="" width="295" height="45"></td>
    <td width="80"></td>
  </tr>
  <tr>
    <td height="40"></td>
  </tr>
</table>
<table width="650" border="0" align="center">
    <tr class="cell02g">
      <td class="style4" width="20">Kunde:</td>
      <td><input size="35"></td>
      <td class="style4">Zeichnungsnummer</td>
      <td><input size="20"> </td>
    </tr>
    <tr class="cell02g">
      <td class="style4">Bezeichnung:</td>
      <td><input size="35"> </td>
      <td class="style4">Protokollnummer</td>
      <td><input size="20"> </td>
    </tr>
    <tr class="cell02g">
      <td class="style4">Teilenummer:</td>
      <td><input size="20"> </td>
      <td class="style4">Progr.:</td>
      <td><input size="20"> </td>
    </tr>
</table>
<hr width="900" align="center">
<table id="Tabelle" width="650" cellpadding="2" border="0" align="center">
   <tr class="style4">
    <td width="30" align="center">Pos</td>
    <td width="60" align="center">Merkmal</td>
    <td width="120" align="left">Elementname</td>
    <td width="100" align="left">Referenz</td>
    <td width="55" align="right">Soll</td>
    <td width="50" align="right">ob.Tol</td>
    <td width="50" align="right">unt.Tol</td>
    <td width="55" align="right">Istwert</td>
    <td width="50" align="right">Abw.</td>
    <td width="55" align="right">&Uuml;bSchr.</td>
   </tr>
   <tr class="cell02g">
    <td width="30"><input type="TEXT" name="pos" size="1" value="1" maxlength="2"></td>
    <td width="30"><input type="TEXT" name="merkmal" size="6" maxlength="8"></td>
    <td width="120"><input type="TEXT" name="elementname" size="16" maxlength="16"></td>
    <td width="100"><input type="TEXT" name="referenz" size="10" maxlength="11"></td>
    <td width="55"><input type="TEXT" name="soll" size="5" maxlength="7" dir="rtl"></td>
    <td width="50"><input type="TEXT" name="obtol" size="5" maxlength="7" dir="rtl"></td>
    <td width="50"><input type="TEXT" name="unttol" size="5" maxlength="7" dir="rtl"></td>
    <td width="55"><input type="TEXT" name="istwert" size="5" maxlength="7" dir="rtl"></td>
    <td width="50"><input type="TEXT" name="abw" size="5" maxlength="7" dir="rtl"></td>
    <td width="55"><input type="TEXT" name="ueberschr" size="5" maxlength="7" dir="rtl"></td>
   </tr>
</table>
<table width="705" border="0" align="center">
   <tr>
    <td align="right">
     <form name="Formular" action="">
        <input type="button" value=" + " onclick="addRowToTable()"><br>
     </form>
    </td>
   </tr>
</table>
</body>
</html>