1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
listexml = new XML();
listexml.load("fichier.xml");
listexml.ignoreWhite = true;
listexml.onLoad = recupData;
aQuestions = new Array();
aReponses = new Array();
function recupData()
{
var noeuds = listexml.firstChild.childNodes;
var nbItem = noeuds.length;
//On parcours la liste
for (var i = 0; i<nbItem; i++) {
aQuestions.push( noeuds[i].attributes.question );
aReponses.push( noeuds[i].attributes.reponse );
}
// placer le texte dans les champs
// ex:
champ1.text = aQuestion[0];
} |