Hallo
habe mir das beispiel mal angeschaut werde da aber nicht schlau drauss.
Ich will das Auswahlfeld nicht Dynamisch gestalten, die Werte ind dem Auswahlfeld sind fix.
Ich bekomme weder mit Value noch mit sonst irgendwas die Werte des Auswahlfeldes angezeigt.
Das einzigste was bisher geklappt hat ist innerText.
Hier ist mal der gesamte Quelltext:
<html>
<head>
<script type="text/javascript">
<!--
var auswahl = new Array("text","text","text","text");
var breite = new Array("4","5","20","7");
var anzahl = new Array("2","5","5","20","11");
var buendig =new Array("rtl","rtl","","rtl");
var basis =new Array("oprn","persnr","maschine","datum","area");
function addRowToTable()
{
var tbl = document.getElementById('Tabelle');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(-1);
var cell1 = row.insertCell(-1);
cell1.className = "cell02g";
var newText = document.createElement("input");
newText.type = "text";
newText.size = "1";
newText.align = "center";
newText.value = iteration;
newText.maxLength = 2;
newText.name = "pos" + iteration;
cell1.appendChild(newText);
for (i=0;i<basis.length;i++)
{
if(basis[i]=="area")
{
cell1 = row.insertCell(-1);
cell1.className = "cell02g";
textarea = document.createElement("TEXTAREA");
textarea.rows = "5";
textarea.cols = "25";
textarea.name = basis[i] + iteration;
cell1.appendChild(textarea);
}
else if(basis[i]=="maschine")
{
cell1 = row.insertCell(-1);
cell1.className = "cell02g";
afeld = document.createElement("SELECT");
newOption = document.createElement("OPTION");
newOption.innerText = 'Neues Optionsfeld';
cell1.appendChild(afeld);
afeld.appendChild(newOption);
}
else
{
cell1 = row.insertCell(-1);
cell1.className = "cell02g";
newText = document.createElement("input");
newText.type = auswahl[i];
newText.size = breite[i];
newText.dir = buendig[i];
newText.maxLength = anzahl[i];
newText.name = basis[i] + iteration;
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>
<form action="speichern.php" method="post">
<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="1" align="center">
<tr class="style4">
<td align="center">Pos</td>
<td align="center">OP.Nr.</td>
<td align="center">Pers.Nr.</td>
<td align="center">Maschinen Nr.</td>
<td align="center">Datum</td>
<td align="center">Text</td>
</tr>
<tr class="cell02g">
<td align="center"><input type="TEXT" name="pos1" size="1" value="1" maxlength="2"></td>
<td align="center"><input type="TEXT" name="opnr1" size="4" maxlength="5" dir="rtl"></td>
<td align="center"><input type="TEXT" name="persnr1" size="5" maxlength="5" dir="rtl"></td>
<td align="center"><input type="TEXT" name="maschine1" size="20" maxlength="20"></td>
<td align="center"><input type="TEXT" name="datum1" size="7" maxlength="11" dir="rtl"></td>
<td><textarea name="area1" rows="5" cols="25"></textarea></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>
<td><input type="submit" value="Speichern"></td>
</form>
</td>
</tr>
</table>
</form>
</body>
</html>