Joachim: Dynamische Formulare mit createElement und appendChild

Beitrag lesen

Hi,

Ich hoffe irgendjemand hat vielleicht eine Idee, wie ich das ganze doch noch Browser-kompatibel hinbekomme.

Wenn ich inputs mit dom erzeuge hat Mozilla keine Probleme:

<html>
<head>
<script type="text/javascript">
var inpNam =  "inp";
var cnt    =  0;
function goForIt() {
 cnt ++;
 var inp             =  document.createElement("input");
  inp.style.width =  "100px";
  inp.setAttribute("type","text");
  inp.setAttribute("name",inpNam + cnt);

br              =  document.createElement("br");
  document.getElementById("dynform").appendChild(inp);
  document.getElementById("dynform").appendChild(br);
}
</script>
</head>
<body>
<form Name="feld" id="dynform">
    <input type="submit" value="Send">
    <input type="button" value="New" onclick="goForIt()">
 <br><br>
</form>
</body>
</html>

ansonsten schau doch mal im dominspector (Mozilla), ob Deine dynamischen elemente ueberhaupt als solche in der Domhirarchie auftauchen.

Gruesse, Joachim

--
Am Ende wird alles gut.