html after javascript function - why it doesn't work?

L

Leszek

I' got a problem with a web site i wrote a javascript:

function zmiana(ile){
while(document.getElementById('accomp').childNodes.length>3){
ostatni=document.getElementById('accomp').lastChild;
document.getElementById('accomp').removeChild(ostatni);
}
for (i=1;i<=ile;i++){
pole=document.createElement("BR");
document.getElementById('accomp').appendChild(pole);

var a=document.createTextNode("Name of accompanying person #"+i+" ")
document.getElementById('accomp').appendChild(a);

accomp.style.fontWeight='bold';

pole=document.createElement("input");
pole.type = "text";
pole.size="50";
pole.id="$name"+i;
pole.name="$name"+i;
document.getElementById('accomp').appendChild(pole);
}
}

and here is a form that using this function:


<form name="accomp">
Number of accompanying persons:
<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";
}
?>
</form>
After this form i've got a few lines of html (just writing some things on
the screen)

Now, the problem is that nothing what is after this form is never done. And
i don't know why
Why is this happening?

Thanks for any ideas

Leszek
 
B

bwucke

Leszek said:
I' got a problem with a web site i wrote a javascript:
<select name="accperson" onChange="zmiana(this.value)">
for ($accperson=1;$accperson<=5;$accperson++){
echo "<option value=\"$accperson\">$accperson </option>\n";
</form>
After this form i've got a few lines of html (just writing some things on
the screen)

Now, the problem is that nothing what is after this form is never done. And
i don't know why
Why is this happening?


What about </select> ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top