problème en [XML+JAVASCRIPT+DOM]

problème en [XML+JAVASCRIPT+DOM] - HTML/CSS - Programmation

Marsh Posté le 28-04-2002 à 16:35:21    

je vous copie mon source, je n'arrive po à trouver l'erreur!!!
<HTML>
<HEAD>
<TITLE>Digital Header</TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
var nb=0; //va contenir le nombre d'input  
function record(nb)  
{  
var xmldoc;
  xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0" );
  xmldoc.async = false;
  xmldoc.load("digital_header.xml" );
var i;
var newtext1;
var newtext2;
var newtext3;
var a;
var b;
   for (i=0;i!=nb;i++)  
  {
newtext1 = xmldoc.documentElement.childNodes(i).childNodes(0);
newtext2 = xmldoc.documentElement.childNodes(i).childNodes(1);
newtext3 = xmldoc.documentElement.childNodes(i).childNodes(2);
    b=i+1;
   a=b+b+b;
   newtext1.text = form1.elements[a-3].value;
    newtext2.text = form1.elements[a-2].value;
    newtext3.text = form1.elements[a-1].checked;
    }
 
var fso;  
var fichier = "";  
fso = new ActiveXObject('Scripting.FileSystemObject';);  
fichier = fso.CreateTextFile("c:/texte.xml", true);  
fichier.write(doc.xml);
}  
 
function AfficheDocXML(){
var Document;
 Document = new ActiveXObject("Microsoft.XMLDOM" );
 Document.async = "false";
 Document.load("digital_header.xml" );
 
  HTMLCode = "<TABLE BORDER=3 CELLSPACING=2 CELLPADDING=6 >";
 + "<col bgcolor="yellow"/>";
 + "<colgroup><col width=50/><col width=50/><col width=50/><col width=50/><col width=50/><col width=50/>";
 + "<col width=50/><col width=50/><col width=50/><col width=50/><col width=50/><col width=50/><col width=50/>";
 + "<col width=50/><col width=50/><col width=50/><col width=50/><col width=50/><col width=50/><col width=50/></colgroup>";
 + "<THEAD bgcolor="silver">";
 + "<tr><td/><th colspan=8><center>D15-D8</center></th><th colspan=8><center>D7-D0</center></th><th></th><th></th><th></th></tr>";
 + "<tr><td>Digital input header address</td><td>D15</td><td>D14</td><td>D13</td><td>D12</td><td>D11</td><td>D10</td>";
 + "<td>D9</td><td>D8</td><td>D7</td><td>D6</td><td>
D5</td><td>D4</td><td>D3</td><td>D2</td><td>D1</td
><td>D0</td><td>Zone de saisie</td><td>Liste deroulante</td><td>Case a cocher</td>";
 + "</tr></THEAD>";
 
 
NodeList=Document.getElementsByTagName("HElement_
Bit_Length" );
 
NodeList2=Document.getElementsByTagName("HElement
_Name" );
 
NodeList3=Document.getElementsByTagName("Address_
16Bit_Offset" );
 
var y=0;
var x=0;
var n=0;
 
var val1= new Array;
var val2= new Array;
 
for(i=0;i<NodeList3.length;i++)
{
 
 HTMLCode += "<TBODY><TR>";
 
 HTMLCode += "<TR>";
 
HTMLCode += "<TD>" + NodeList3(i).xml + "</TD>";
 
while(y<NodeList.length)
{
val1[y]=NodeList(y).text;
val2[y]=NodeList2(y).text;
y++;
}
 
 
n=0;
 
while(n<=15)
{
HTMLCode += "<th colspan="+eval(val1[x])+">"+val2[x]+"</th>";
n=n+eval(val1[x]); //convertit un tableau de caracteres en tableau de valeurs
//document.writeln(n);
x++;
}
 
 
 
 HTMLCode += "<td><input type=text></td>";
 
 HTMLCode += "<td><select name=exemple>";
 HTMLCode += "<option value=choix1>Choix 1";
 HTMLCode += "<option value=choix2>Choix 2";
 HTMLCode += "<option value=choix3>Choix 3";
 HTMLCode += "</select></td>";  
 
 HTMLCode += "<td><center><input type=checkbox></center></td>";  
 
nb++;
 
 HTMLCode += "</TR>";
 
 HTMLCode += "</TBODY>";
 
}
 
 HTMLCode += "<TABLE>";
HTMLCode += "<br><br>";
HTMLCode += "<input type=button name=Valide value=Envoyer OnClick=record(nb)>";  
 AfficheDIV.innerHTML = HTMLCode;
}
</SCRIPT>
<BODY onload="AfficheDocXML();">
<table>
<form name="form1">
<DIV ID="AfficheDIV"></DIV>
</form></table></BODY>
</HTML>


---------------
"J'adore me promener en ville avec ma décapotable" JFK
Reply

Marsh Posté le 28-04-2002 à 16:35:21   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed