Z.N.S.: Formulare beliebig oft erweitern

Beitrag lesen

abend,

---code anfang---
<!Doctype html Public"-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>Submission Form for Abstracts</title>

<script language="JavaScript">
curAuthor = 2;
function addAuthor(IndNr) {
 FormTags =  "<table><tr><td><b>Author #" + IndNr + "</b></td></tr><tr><td>Surname:<br>" +
        "<input type=text name=surname" + IndNr + " size=30></td>" +
       "<td>Name:<br><input type=text name=name" + IndNr + " size=30></td></tr>" +
       "</table></td></tr><tr><td><table><tr><td>Institution:<br>" +
       "<input type=text name=institution" + IndNr + " size=30></td>" +
       "<td>EMail:<br><input type=text name=email" + IndNr + "  size=30></td></tr></table><br>";
 DivInhalt = document.getElementById("HierWirdAngefuegt").innerHTML;
 document.getElementById("HierWirdAngefuegt").innerHTML = DivInhalt + FormTags;
 curAuthor++;
}
</script>

</head>
<body>

<h2>Submission Form for Abstracts</h2>
<form method="post" action="author.php">

<center>
<table border="2" cellpadding="1" cellspacing="1">
 <tr>
  <td><b>Other Author(s)</b></td>
 </tr>
 <tr>
  <td><b>Author #1:</b></td>
 </tr>
 <tr>
  <td>
   <table>
    <tr>
     <td>Surname:<br>
      <input type="text" name="surname1" size="30"></td>
     <td>Name:<br>
      <input type="text" name="name1" size="30"></td>
    </tr>
   </table>
  </td>
 </tr>
  <tr>
  <td>
   <table>
    <tr>
     <td>Institution:<br>
      <input type="text" name="institution1" size="30"></td>
     <td>EMail:<br>
      <input type="text" name="email1" size="30"></td>
    </tr>
   </table>
  </td>
 </tr>
 <tr><td id="HierWirdAngefuegt"></td></tr>
</table>
</center>

<input type="button" name="add" value=add onClick="addAuthor(curAuthor)">

</body></html>
---code---ende

nur die feinheiten musst du schon selber machen ;) habe das script nur
im IE getestet... viel spaß

mfg,
(tanz das)
Z.N.S.

--
<img src="http://www.dmp-web.de/comunicout/neubauten.gif" border="0" alt="">