Code: Alles auswählen.
<html>
<head>
<title>Formulareingaben überprüfen</title>
<script type="text/javascript">
var counter;
function addField () {
if (document.Formular.Eingabe.value != "") {
if (counter == null)
{
counter = 1;
}
if (counter == 1)
{
document.Formular.Eingabe1.value = document.Formular.Eingabe.value;
}
if (counter == 2)
{
document.Formular.Eingabe2.value = document.Formular.Eingabe.value;
}
if (counter == 3)
{
document.Formular.Eingabe3.value = document.Formular.Eingabe.value;
}
counter ++;
document.Formular.Eingabe.value = "";
document.Formular.Eingabe.focus();
}
}
</script>
</head>
<body>
<h1>Formular</h1>
<form name="Formular" action="http://de.selfhtml.org/cgi-bin/formview.pl"
method="post">
<pre>
Eingabe: <input type="text" size="40" name="Eingabe">
Button: <input type="button" value="Eingabe" onclick="addField()">
<input type="submit" value="Absenden">
Zum Absenden muss eine Internet-Verbindung bestehen!
</pre>
<input type="hidden" size="40" name="Eingabe1">
<input type="hidden" size="40" name="Eingabe2">
<input type="hidden" size="40" name="Eingabe3">
</form>
</body>
</html>
Code: Alles auswählen.
<script language="JavaScript" type="text/javascript">
<!-- function hide_div(layer) {
document.all[layer].style.visibility="hidden";
}
function show_div(layer) {
document.all[layer].style.visibility="visible";
}
//--> </script>
<form name="umfrage" method = "post" >
<table cellpadding="4" border="0" align="center">
<tr><td>Name:</td>
<td colspan="2"><input type="text" name="name" size="30" >
</tr>
..............
<tr>
<td colspan="3" align="center">Wenn Sie eine neue EmailAdresse haben, bitte clicken Sie
<input type="button" onClick="javascript:show_div('show')" value="hier">
</td></tr>
<tr><td>Senden:</td>
<td colspan="2" align="center"><input type="submit" name="onInputprocessing" value="Ok"></td></tr>
</table>
<DIV id="show" style="visibility:hidden" align="center">
<table cellpadding="4" border="0" align="center">
<tr><td valign="center">EmailAdresse:</td>
<td colspan="2"><input type="text" name="adresse" size="30" ></td></tr></table>
</DIV>
</form>
Code: Alles auswählen.
<script type="text/javascript">
function hide_div(layer)
{
document.all[layer].style.visibility="hidden";
}
function show_div(layer)
{
document.all[layer].style.visibility="visible";
}
function add()
{
if (document.umfrage.Mailadressen.value == "")
{
document.umfrage.Mailadressen.value = document.umfrage.adresse.value;
document.umfrage.adresse.value = "";
}
else
{
document.umfrage.Mailadressen.value =
document.umfrage.Mailadressen.value + ";" + document.umfrage.adresse.value;
document.umfrage.adresse.value = "";
}
}
</script>
<form name="umfrage" method = "post" >
<table cellpadding="4" border="0" align="center">
<tr><td>Name:</td>
<td colspan="2"><input type="text" name="name" size="30" >
</tr>
..............
<tr>
<td colspan="3" align="center">Wenn Sie eine neue EmailAdresse haben, bitte clicken Sie
<input type="button" onClick="javascript:show_div('show')" value="hier">
</td></tr>
<tr><td>Senden:</td>
<td colspan="2" align="center"><input type="submit" name="onInputprocessing" value="Ok"></td></tr>
</table>
<DIV id="show" style="visibility:hidden" align="center">
<table cellpadding="4" border="0" align="center">
<tr><td valign="center">EmailAdresse:</td>
<td colspan="2"><input type="text" name="adresse" size="30" ></td>
<td><input type="button" onClick="add()" value="weite Emailadresse">
</tr></table>
</DIV>
<input type="hidden" size="3000" name="Mailadressen">
</form>