Bonjour,
Je souhaite insérer une ligne dans une table avec dans la 2eme cellule un type input
Comment faire ? je n'ai pas trouvé la propriété
Merci de votre réponse
Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 <!DOCTYPE html> <html> <body> <h2>My First JavaScript</h2> <script> function create() { var table = document.getElementById("tab_cmde"); ligne = table.insertRow(-1); cell = ligne.insertCell(0); cell.style = "vertical-align: top;text-align: center; width: 50px;"; cell.innerHTML ="test"; cell = ligne.insertCell(1); cell.input = "id=\"txt_qte_ligne\" type=\"number\" size=\"6\" maxlength=\"3\" min=\"1\" max=\"999\" onChange=\"Change_Qte(this.parentNode.parentNode.rowIndex)\""; cell.value ="1"; /*<input id="txt_qte_ligne" type="number" size="6" maxlength="3" min="1" max="999" onChange="Change_Qte(this.parentNode.parentNode.rowIndex)";*/ } </script> <table style="text-align: center; width: 800px; height: 180px;" border="1" cellpadding="2" cellspacing="2"> <tr><td> <table cellspacing="0" cellpadding="1" border="1" width="800px" > <tr> <th>QTE</th> <th>ARTICLE</th> <th>PU</th> <th>TOTAL</th> </tr> </table> </td></tr> <tr><td> <div style="width:800px; height:180px; overflow:auto;"> <table id="tab_cmde" cellspacing="0" cellpadding="1" border="1" width="800px" > </table> </div> </td></tr> </table> <br> <button type="button" onclick="document.getElementById('demo').innerHTML = create()"> Click me to insert a row</button> <p id="demo"></p> </body>
Partager