Intégrer un objet select dans une form
Bonjour
Dans mon document html j'ai un formulaire (form1) contenant un tableau.
Je voudrais insérer en JavaScript un objet select dans le formulaire (form1) et dans la cellule du tableau
Voici le script:
Code:
1 2 3 4 5
| <form method='POST' name='form1'>
<table border='2' align='center'>
<tr><td>PARENT</td><td id='td_parents'>
</td></tr>
</table></form> |
Code:
1 2 3 4 5 6 7
| v_div_parent = document.getElementById ('td_parents');
v_div_enfant= document.createElement('select')
v_div_enfant.setAttribute('id','enfant_lien_parents[]');
v_div_enfant.setAttribute('name','enfant_lien_parents[]');
v_div_enfant.setAttribute('size','1');
v_div_parent.appendChild(v_div_enfant); |
L'intégration dans la cellule du tableau marche bien. Mais comment l'intégrer dans form1?
Merci