Bonjour,
Je suis d�butante en javascript. Je souhaiterais cr�er un annuaire (du personnel) dynamique avec un moteur de recherche sur une base xml. Pour l'instant, je ne peux effectuer qu'une recherche par nom. Pourriez-vous m'aider afin d'effectuer, � la fois, via un script, une recherche par nom et une recherche par service (avec un menu d�roulant afin de proposer les services).
<HTML><title>test xmtl</title>
<xml ID="DSOFFKAMA01" SRC="base_agents_ao�t.xhtml"></xml>
<body>
<h2 align="center"> <font color="black"><u>ANNUAIRE DES SERVICES</u></font></h2>
<input type="texte" name="cherche" id="cherche">
<BUTTON ONCLICK="rec()">
Chercher la personne (NOM)
</BUTTON>
<HR noshade size=3 color="RED">
</DIV>
<div id="reponse1" name="reponse1">
</div>
</body>
<script>
function rec()
{
temp = document.all.cherche.value+'';
temp = temp.toUpperCase();
DSOFFKAMA01.recordset.movefirst();
Document = DSOFFKAMA01.XMLDocument;
reponse = "R�sultat de la recherche :<br><table border=1>";
for (i=0;i<Document.documentElement.childNodes.length;i++)
{
temp2 = Document.documentElement.childNodes(i).childNodes(0).text;
temp2 = temp2.toUpperCase();
if (temp2.indexOf(temp) > -1)
{
reponse = reponse + "<tr>"
for (h=0;h<=4;h++)
{
reponse = reponse + "<td>" + Document.documentElement.childNodes(i).childNodes(h).text + "</td>"
}
reponse = reponse + "</tr>"
}
else
{
DSOFFKAMA01.recordset.movenext();
}
}
reponse = reponse + "</table>"
document.all.reponse1.innerHTML = reponse;
}
</script>
<BR>
<SCRIPT>
MERCI
Partager