Dennis Mende: Formularfelder hinzufügen

Beitrag lesen

Sorry, war nen kleiner Fehler beim <select>, nämlich onchange und selected fehlte :-)

<body>
<form method=POST action=send.php name=call>
<input type=hidden name=id value=1>
<script type=text/javascript>
  function man_sel()  {
    if(document.call.next_call.selectedIndex==0) {
      inp = document.createElement("input");
      inp.style.width = "120px";
      inp.setAttribute("type","text",true);
      inp.setAttribute("name","next_call",true);
      inp.setAttribute("value","<? echo date('d.m.Y'); ?>",true);
      pos = document.getElementById('next_call');
      pos.replaceChild(inp,document.call.next_call);
    }
  }
</script>
<span id=next_call>
  <select name=next_call onchange=man_sel()>
    <option>Anderes Datum eingeben</option>
    <option selected>01.01.1970</option>
    [...]
  </select>
</span>
<input type=submit value=Senden>
</form>
</body>