L
Leszek
Hi
I've got a proble because text inputs made by function are
outside frameset and below submit button.
What should I do to make it work properly?
Here is code
function zmiana(ile){
var formObj = document.forms["dane"];
while(formObj.childNodes.length >3)
{
formObj.removeChild(formObj.lastChild);
}
for (i=1;i<=ile;i++){
pole=document.createElement("BR");
formObj.appendChild(pole);
a=document.createTextNode("Name of accompanying person #"+i+" ")
formObj.appendChild(a);
formObj.elements.style.fontWeight='bold';
pole=document.createElement("input");
pole.type = "text";
pole.size="40";
pole.id="$name"+i;
pole.name="$name"+i;
formObj.appendChild(pole);
}
}
<form name="dane" action="uzytkownik.php" method.post>
<fieldset>
<select name="accperson" onChange="zmiana(this.value)">
<?php
$accperson=0;
echo "<option value=\"$accperson\" selected >$accperson</option> \n";
for ($accperson=1;$accperson<=5;$accperson++){
echo "<option value=\"$accperson\">$accperson </option>\n";
}
?>
</select>
<p align="center">
<input type="submit" value="Wyslij dane" />
</p>
</fieldset>
</form0
I've got a proble because text inputs made by function are
outside frameset and below submit button.
What should I do to make it work properly?
Here is code
function zmiana(ile){
var formObj = document.forms["dane"];
while(formObj.childNodes.length >3)
{
formObj.removeChild(formObj.lastChild);
}
for (i=1;i<=ile;i++){
pole=document.createElement("BR");
formObj.appendChild(pole);
a=document.createTextNode("Name of accompanying person #"+i+" ")
formObj.appendChild(a);
formObj.elements.style.fontWeight='bold';
pole=document.createElement("input");
pole.type = "text";
pole.size="40";
pole.id="$name"+i;
pole.name="$name"+i;
formObj.appendChild(pole);
}
}
<form name="dane" action="uzytkownik.php" method.post>
<fieldset>
<select name="accperson" onChange="zmiana(this.value)">
<?php
$accperson=0;
echo "<option value=\"$accperson\" selected >$accperson</option> \n";
for ($accperson=1;$accperson<=5;$accperson++){
echo "<option value=\"$accperson\">$accperson </option>\n";
}
?>
</select>
<p align="center">
<input type="submit" value="Wyslij dane" />
</p>
</fieldset>
</form0