Таблица:
<table border=1>
<tr BGCOLOR=EEEEFF><td width=200 rowspan=8>
<INPUT TYPE=text SIZE=20 id=idf1 VALUE="" onChange="process(this.id)">
</td><td width=200 rowspan=4>
<INPUT TYPE=text SIZE=20 id=idf11 VALUE="" onChange="process(this.id)">
</td><td width=200 rowspan=2>
<INPUT TYPE=text SIZE=20 id=idf111 VALUE="" onChange="process(this.id)">
</td><td width=200>
<INPUT TYPE=text SIZE=20 id=idf1111 VALUE="" onChange="process(this.id)">
</td></tr>
<tr BGCOLOR=FFEEFF><td>
<INPUT TYPE=text SIZE=20 ID=idf1112 VALUE="" onChange="process(this.id)">
</td></tr><tr BGCOLOR=EEEEFF><td BGCOLOR=FFEEFF rowspan=2>
<INPUT TYPE=text SIZE=20 id=idf112 VALUE="" onChange="process(this.id)">
</td><td>
<INPUT TYPE=text SIZE=20 id=idf1121 VALUE="" onChange="process(this.id)">
</td></tr>
<tr BGCOLOR=EEEEFF><td BGCOLOR=FFEEFF>
<INPUT TYPE=text SIZE=20 id=idf1122 VALUE="" onChange="process(this.id)">
</td></tr><tr BGCOLOR=EEEEFF><td BGCOLOR=FFEEFF rowspan=4>
<INPUT TYPE=text SIZE=20 id=idf12 VALUE="" onChange="process(this.id)">
</td><td rowspan=2>
<INPUT TYPE=text SIZE=20 id=idf121 VALUE="" onChange="process(this.id)">
</td><td>
<INPUT TYPE=text SIZE=20 id=idf1211 VALUE="" onChange="process(this.id)">
</td></tr>
<tr BGCOLOR=EEEEFF><td BGCOLOR=FFEEFF>
<INPUT TYPE=text SIZE=20 id=idf1212 VALUE="" onChange="process(this.id)">
</td></tr><tr BGCOLOR=EEEEFF><td BGCOLOR=FFEEFF rowspan=2>
<INPUT TYPE=text SIZE=20 id=idf122 VALUE="" onChange="process(this.id)">
</td><td>
<INPUT TYPE=text SIZE=20 id=idf1221 VALUE="" onChange="process(this.id)">
</td></tr><tr BGCOLOR=EEEEFF><td BGCOLOR=FFEEFF>
<INPUT TYPE=text SIZE=20 id=idf1222 VALUE="" onChange="process(this.id)">
</td></tr>
</table>
<table border=2>
<tr>
<td>
<div id="divProcess" />
</td>
<td>
<div id="div2" />
</td>
<tr>
</table>
Функции:
var idForm = "";
function process(idFI)
{
for (var i=0; i<idFI.length; i++){
document.getElementById("divProcess").innerHTML +=
'<i>' + idFI[i] + '</i><br>';
if (idFI[i].length>7){
break;}
else{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
{
name = encodeURIComponent(document.getElementById(idFI[i]).value);
xmlHttp.open("GET", "rss.php?name=" + name, true);
idForm = idFI[i];
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
}
}
}
}
function handleServerResponse()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
xmlResponse = xmlHttp.responseXML;
xmlRoot = xmlResponse.documentElement;
idArray = xmlRoot.getElementsByTagName('id');
nameArray = xmlRoot.getElementsByTagName('name');
otecArray = xmlRoot.getElementsByTagName('otec');
matArray = xmlRoot.getElementsByTagName('mat');
idFormOtec = idForm + "1";
idFormMat = idForm + "2";
for (var i=0; i<idArray.length; i++){
document.getElementById("div2").innerHTML +=
'<i>' + idFormOtec + '</i><br>';
if (idFormOtec.length>7){
break;}
else{
document.getElementById(idForm).value = nameArray.item(i).firstChild.data;
document.getElementById(idFormOtec).value = otecArray.item(i).firstChild.data;
document.getElementById(idFormMat).value = matArray.item(i).firstChild.data;
}}
idFAr=new Array()
idFAr[0] = idFormOtec;
idFAr[1] = idFormMat;
setTimeout('process(idFAr)', 100);
}
else
{
alert("There was a problem accessing the server: " + xmlHttp.statusText);
}
}
}
Вобщем если вводить имя в инпут, то в функцию process передается только один id в который ввели текст, после отправки на сервер запроса и обработки ответа в функции handleServerResponse появляются еще два id инпутов? содержание которых надо отправить на сервер.
idFAr=new Array()
idFAr[0] = idFormOtec;
idFAr[1] = idFormMat;
setTimeout('process(idFAr)', 100);