Bernd_das_Brot
08.05.2010, 12:11
Hallo zusammen!
Kann mir jemand einen eleganten Loesungsansatz fuer folgendes Problem geben:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function Ausgabe () {
ausgabe = document.Formular.l1.value;
ausgabe += document.Formular.l2.value;
ausgabe += document.Formular.l3.value;
ausgabe += document.Formular.l4.value;
ausgabe += document.Formular.l5.value;
alert(ausgabe);
return true;
}
-->
</script>
</head>
<body>
<form name="Formular" action="auswertung.php" method="POST" onsubmit="return Ausgabe();">
<input type="text" name="l1" value="-"> #1<br>
<input type="text" name="l2" value="-"> #2<br>
<input type="text" name="l3" value="-"> #3<br>
<input type="text" name="l4" value="-"> #4<br>
<input type="text" name="l5" value="-"> #5<br>
<button type="submit">absenden</button>
</form>
</body>
</html>
Dies ist einfach ein Beispielcode. edit: (Ein Beispielcode. Mit 'elegant' meine ich eine Verarbeitung von weit mehr als fuenf 'input'-Feldern.) Ich wuerde das Ganze lieber kuerzer fassen als mit etlichen Anweisungen wie diesen hier:
ausgabe += document.Formular.[...].value;
Kann mir jemand einen eleganten Loesungsansatz fuer folgendes Problem geben:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
function Ausgabe () {
ausgabe = document.Formular.l1.value;
ausgabe += document.Formular.l2.value;
ausgabe += document.Formular.l3.value;
ausgabe += document.Formular.l4.value;
ausgabe += document.Formular.l5.value;
alert(ausgabe);
return true;
}
-->
</script>
</head>
<body>
<form name="Formular" action="auswertung.php" method="POST" onsubmit="return Ausgabe();">
<input type="text" name="l1" value="-"> #1<br>
<input type="text" name="l2" value="-"> #2<br>
<input type="text" name="l3" value="-"> #3<br>
<input type="text" name="l4" value="-"> #4<br>
<input type="text" name="l5" value="-"> #5<br>
<button type="submit">absenden</button>
</form>
</body>
</html>
Dies ist einfach ein Beispielcode. edit: (Ein Beispielcode. Mit 'elegant' meine ich eine Verarbeitung von weit mehr als fuenf 'input'-Feldern.) Ich wuerde das Ganze lieber kuerzer fassen als mit etlichen Anweisungen wie diesen hier:
ausgabe += document.Formular.[...].value;