Hallo,
ich habe mir folgendes Script gebastelt.
Leider bekomme ich nicht hin, wie ich den Gesamtpreis pro Zeile berechnen kann.
Vielleicht könnt Ihr mir helfen.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
var i = 1;
function NeuesFeld()
{
var row = document.getElementById('formtable').insertRow(i);
var cell_1 = row.insertCell(0);
var cell_2 = row.insertCell(1);
var cell_3 = row.insertCell(2);
var cell_4 = row.insertCell(3);
var cell_5 = row.insertCell(4);
var text = document.createTextNode('Pos ' + (i + 1));
cell_1.appendChild(text);
var input = document.createElement('input');
input.type = 'text';
input.name = '$menge[]';
input.size = 8;
input.maxlength = 150;
cell_2.appendChild(input);
var input = document.createElement('input');
input.type = 'text';
input.name = 'beschreibung[]';
input.size = 111;
input.maxlength = 150;
cell_3.appendChild(input);
var input = document.createElement('input');
input.type = 'text';
input.name = '$epreis[]';
input.size = 9;
input.maxlength = 150;
cell_4.appendChild(input);
var input = document.createElement('input');
input.type = 'text';
input.name = '$gpreis[]';
input.size = 12;
input.maxlength = 150;
cell_5.appendChild(input);
i++;
}
-->
</script>
</head>
<body>
<table border="0" width="100%">
<colgroup>
<col width="1">
<col width="3">
<col width="380">
<col width="3">
<col width="3">
</colgroup>
<tr>
<b>
<td><b>Pos.</b></td>
<td><b>Menge</b></td>
<td><b>Beschreibung</b></td>
<td><b>E-Preis EUR</b></td>
<td><b>G-Preis EUR</b></br></td>
</tr>
</table>
<form name="posting" action="save.php" method="post">
<table id="formtable" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>Pos 1</td>
<td><input name="$menge[]" type="text" size="8" maxlength="150" /></td>
<td><input name="beschreibung[]" type="text" size="111" maxlength="150" /></td>
<td><input name="$epreis[]" type="text" size="9" maxlength="150" /></td>
<td><input name="$gpreis[]=$menge[]*$epreis[]" type="text" size="12" maxlength="150" /></td>
</br>
</tr>
<tr>
<td colspan="2"><input type="button" onclick="NeuesFeld();" value="Feld hinzufügen" /></td>
</tr>
</table>
</form>
</body>
</html>
ich habe mir folgendes Script gebastelt.
Leider bekomme ich nicht hin, wie ich den Gesamtpreis pro Zeile berechnen kann.
Vielleicht könnt Ihr mir helfen.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
var i = 1;
function NeuesFeld()
{
var row = document.getElementById('formtable').insertRow(i);
var cell_1 = row.insertCell(0);
var cell_2 = row.insertCell(1);
var cell_3 = row.insertCell(2);
var cell_4 = row.insertCell(3);
var cell_5 = row.insertCell(4);
var text = document.createTextNode('Pos ' + (i + 1));
cell_1.appendChild(text);
var input = document.createElement('input');
input.type = 'text';
input.name = '$menge[]';
input.size = 8;
input.maxlength = 150;
cell_2.appendChild(input);
var input = document.createElement('input');
input.type = 'text';
input.name = 'beschreibung[]';
input.size = 111;
input.maxlength = 150;
cell_3.appendChild(input);
var input = document.createElement('input');
input.type = 'text';
input.name = '$epreis[]';
input.size = 9;
input.maxlength = 150;
cell_4.appendChild(input);
var input = document.createElement('input');
input.type = 'text';
input.name = '$gpreis[]';
input.size = 12;
input.maxlength = 150;
cell_5.appendChild(input);
i++;
}
-->
</script>
</head>
<body>
<table border="0" width="100%">
<colgroup>
<col width="1">
<col width="3">
<col width="380">
<col width="3">
<col width="3">
</colgroup>
<tr>
<b>
<td><b>Pos.</b></td>
<td><b>Menge</b></td>
<td><b>Beschreibung</b></td>
<td><b>E-Preis EUR</b></td>
<td><b>G-Preis EUR</b></br></td>
</tr>
</table>
<form name="posting" action="save.php" method="post">
<table id="formtable" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>Pos 1</td>
<td><input name="$menge[]" type="text" size="8" maxlength="150" /></td>
<td><input name="beschreibung[]" type="text" size="111" maxlength="150" /></td>
<td><input name="$epreis[]" type="text" size="9" maxlength="150" /></td>
<td><input name="$gpreis[]=$menge[]*$epreis[]" type="text" size="12" maxlength="150" /></td>
</br>
</tr>
<tr>
<td colspan="2"><input type="button" onclick="NeuesFeld();" value="Feld hinzufügen" /></td>
</tr>
</table>
</form>
</body>
</html>