Bon, tout d'abord un grand merci pour ton aide.
Voici où j'en suis :
Je récupère bien les attributs, mais ensuite, la partie "SECTION" ne fonctionne pas, ou mal.
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
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
54
55
56 function CreationPage(P_Terrain) { WFichier = G_RepXML + G_TERRAIN + ".xml"; $(document).ready( function() { $.ajax( { type: "GET", url: WFichier, dataType: "xml", success: function(xml) { $(xml).find('TERRAINS').each( function() { var WCode_Terrain = $(this).attr('code_terrain'); var WNom_Terrain = $(this).attr('nom_terrain'); // Application de la classe pour le nom de l'aérodrome. var ObjCell = document.getElementById("Cell_Titre"); ObjCell.className = "SousTitre"; Cell_Titre.innerHTML = WNom_Terrain; } ) $(xml).find('SECTION').each( function() { var WNom_Section = $(this).attr('nom_section'); var WLib = $(this).find('LIB').text(); var WElement = $(this).find('ELEMENT').text(); var WType = $(this).find('TYPE').text(); var WSize = $(this).find('SIZE').text(); var WMax_Car = $(this).find('MAX_CAR').text(); var WCellule = $(this).find('CELLULE').text(); var WLig = $(this).find('LIG').text(); var WCol = $(this).find('COL').text(); var WInit = $(this).find('INIT').text(); var WClasse = $(this).find('NOM_CLASSE').text(); // Création de l'élément var oInput = document.createElement(WElement); oInput.setAttribute('type', WType); oInput.setAttribute('size', WSize); // Taille de l'input à l'écran oInput.setAttribute('maxlength', WMax_Car); oInput.setAttribute('value', WInit); var ObjTab = document.getElementById("Tab_Stage"); ObjTab.rows[WLig].cells[WCol].appendChild(oInput); var WObjCell = document.getElementById(WCellule); WObjCell.innerHTML = WLib; alert(WLib + G_CrLf + WElement + G_CrLf + G_CrLf + WType); } ) } } ); } ); }
Le "alert" affiche une concaténation des LIB et des ELEMENT ???
Et bien sur, les éléments ne sont pas créés.
Qu'est-ce que je fais mal ?
Partager