Hallo, ich möchte mir ein kleines Angebotsrechnungprogramm entwickeln.
Da leider im Netz kein Editor mit Rechenfunktionen gefunden habe, vielleicht kennt ihr eins.
Nun wollte ich es in Form einer Tabelle erstellen. Nun klappt die Berechnung in Zeile 1, aber nach Buttonklick auf neue Zeile, rechnet er nicht mehr.
Hat jemand einen Tip für michß
Marcus
HTML
<!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 startCalc(){
interval = setInterval("calc()",1);
}
function calc(){
gpreis = (document.autoSumForm.menge.value * document.autoSumForm.epreis.value);
document.autoSumForm.Summe.value = gpreis * 2
document.autoSumForm.gpreis.value = gpreis
}
function stopCalc(){
clearInterval(interval);
}
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++;
}
// End -->
-->
</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="autoSumForm" 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" value="" onkeyup="calc();" size="8" maxlength="150" /></td>
<td><input name="beschreibung" type="text" size="111" maxlength="150" /></td>
<td><input name="epreis" type="text" value="" onkeyup="calc();" size="9" maxlength="150" /></td>
<td><input name="gpreis" type="text" size="12" maxlength="150" /></td>
</br>
</tr>
<tr>
<td>Summe</td><td> =</td><td><input type=text name="Summe">Euro
</td>
<td colspan="2"><input type="button" onclick="NeuesFeld();startCalc();" value="Feld hinzufügen" /></td>
</tr>
</table>
</form>
</body>
</html>
Alles anzeigen