Bonjour,

Je rajoute dynamiquement des tableaux dont la mise en forme résultante devra être ceci :

Code : 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
<table>
	<tr>
		<td>
			<table>
				<tr>
					<td></td>
				</tr>
			</table>
			<table>
				<tr>
					<td></td>
					<td>
						<table>
							<tr>
								<td></td>
							</tr>
						</table>
					</td>
					<td></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
En javascript, j'ai fait comme cela, mais ce n'est pas correct :

Code : 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
ligne = document.createElement('table');
	cell = document.createElement('tr');
		ligne.appendChild(cell);
		cell = document.createElement('td');
			ligne.appendChild(cell);
			cell = document.createElement('table');
				ligne.appendChild(cell);
				cell = document.createElement('tr');
					ligne.appendChild(cell);
					cell = document.createElement('td');
						ligne.appendChild(cell);
			==============================================
			cell = document.createElement('table');
				ligne.appendChild(cell);
				cell = document.createElement('tr');
					ligne.appendChild(cell);
					cell = document.createElement('td');
						ligne.appendChild(cell);
							cell = document.createElement('td');
							ligne.appendChild(cell);
								cell = document.createElement('table');
								ligne.appendChild(cell);
									cell = document.createElement('tr');
										ligne.appendChild(cell);
										cell = document.createElement('td');
											ligne.appendChild(cell);
document.getElementById('id').appendChild(ligne);
En effet, j'ai 2 <table> au même niveau imbriqués dans une table de niveau supérieur (voir les ======================)

Les 2 tables sont dans une boucle JS, je pourrais en avoir 1 ou 10.

le problème vient du choix du moment ou écrire "ligne".

J'espère avoir été clair.

Merci d'avance