tOM: Die Lösung... ;)

Beitrag lesen

Ok hier - sollte funzen ;)

Jetzt hab ich aber was gut! *g

<!doctype html public "-//W3C//DTD HTML 4.0 //DE">
<html>
<head>
<title>
Lydia's Formular © TOM ;-)
</title>
<style type="text/css">
<!--
-->
</style>
<script type="text/javascript">
      var byid = false;
      var docall = false;
      var doclay = false;
function init(){
 var Name = "childs";
 if(document.getElementById) this.byid = true;
            else{
                 if(document.all && !document.getElementById) {this.byid = false; this.docall = true;
                 }else{ if(document.layers) this.doclay = true;
                       else alert('Fehler beim DOM - Modell!\n\nBitte an den Programmierer wenden!\n(Thomas.Kagerer@erl11.siemens.de oder Webmaster@ngwebdesign.de)');
                 }
            }
 if (this.docall && !this.byid) {
               document.all[Name].style.display = 'none';
           }
          else if (this.byid){
               document.getElementById(Name).style.display = 'none';
           }else if(this.doclay)
                 document[Name].style.display = 'none';
}
function setchilds(){
var Name = "childs";
var menge;
var i;
var div = "";
menge = document.form.kinder.options[document.form.kinder.options.selectedIndex].value;
for(i=1; i<=menge; i++){
 div += 'Vorname Kind' + i + ': <input type="text" name="kind' + i + 'V" value=""><br>';
}
if (this.docall && !this.byid) {
               document.all[Name].innerHTML = div;
        document.all[Name].style.display = 'block';
           }
          else if (this.byid){
               document.getElementById(Name).innerHTML = div;
               document.getElementById(Name).style.display = 'block';
           }else if(this.doclay){
                 document[Name].innerHTML = div;
                 document[Name].style.display = 'block';
  }
}
<!--
//-->
</script>
</head>
<body onload="init();">
<form name="form" action="get">
Wie viele Kinder haben sie?
<select name="kinder" onchange="setchilds();">
<option value="0">Bitte auswählen</option>
<option value="1">1 Kind</option>
<option value="2">2 Kinder</option>
<option value="3">3 Kinder</option>
<option value="4">4 Kinder</option>
<option value="5">5 Kinder</option>
<option value="6">6 Kinder</option>
<option value="7">7 Kinder</option>
<option value="8">8 Kinder</option>
<option value="9">9 Kinder</option>
<option value="10">10 Kinder</option>
</select>
<br>
<div id="childs" style="display:block;">
Vorname Kind1: <input type="text" name="kind1V" value=""><br>
Vorname Kind2: <input type="text" name="kind2V" value=""><br>
Vorname Kind3: <input type="text" name="kind3V" value=""><br>
Vorname Kind4: <input type="text" name="kind4V" value=""><br>
Vorname Kind5: <input type="text" name="kind5V" value=""><br>
Vorname Kind6: <input type="text" name="kind6V" value=""><br>
Vorname Kind7: <input type="text" name="kind7V" value=""><br>
Vorname Kind8: <input type="text" name="kind8V" value=""><br>
Vorname Kind9: <input type="text" name="kind9V" value=""><br>
Vorname Kind10: <input type="text" name="kind10V" value=""><br>
</div>
</form>
</body>
</html>

Funtzt übrigends in allen Browsern, auch wenn JS deaktiviert ist. Nur halt dass dann alle 10 da stehen ;)

tOM

P.S.: Kommt sogar durch den Vali *g