Bonjour,

Alors que mes appels à mes fonctions javaScript dans un fichier externe ont toujours bien fonctionnés jusqu'à présent, je tombe maintenant sur un os.

Dans un fichier d'interface, j'ai le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
<select name ='codePostal' id='codePostal' onChange='majLoc();'>
Dans mon fichier fonctionsJs.js, j'ai la fonction suivante :

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
function majLoc()
{
 {
  xhrMajLoc=getXhr();
  xhrMajLoc.onreadystatechange = function()
   {
    if(xhrMajLoc.readyState == 4 && xhrMajLoc.status == 200)
     {
      document.getElementById('divLocalites').innerHTML = xhrMajLoc.responseText;
     }
   }
  xhrMajLoc.open("POST",'../transferts/majLoc.php',true);
  xhrMajLoc.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  codePost = document.getElementById('codePostal') ;
  codePostal = codePost.options[codePost.selectedIndex].value;
 
  xhrMajLoc.send("codePostal="+codePostal);
 }
 
}
Lors de l'exécution de cette fonction, fireBug m'indique l'erreur suivante :

"getXhr is not defined".

Je ne vois pas la source de mon problème.

Quelq'un pourrait-il éclairer ma lanterne?

Merci d'avance...

Christophe