J'ai créé un tableau en
et quand j'ai voulu insérer une ligne par java-script le tableau a été créé mais le contenu ne s'affiche pas
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 <!DOCTYPE html> <html lang="en"> <head> <title>Document</title> <script src="tableau.js"></script> </head> <body> <table border="2" id='mytable'> <th> <td>Colonne 1</td> <td>Colonne 2</td> </th> </table> </body> </html>
merci de votre coopération
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 var table=document.getElementById('mytable'); var row=table.insertRow(-1); //alert(row); var cel1=row.insertCell(0); //console.log(cel1); var cel2=row.insertCell(1); cel1.innertHTML='Cellule 21'; cel2.innertHTML='Cellule 22';
Partager