Bonjour,
J'ai un problème, j'ai un lien appelant une fonction:
<a href="javascript:showhigh(id,format)">
dans cette fonction j'ai:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| function showHigh(id,format){
var url2 = "/showhightext/" + id + "/" + format;
var url3 = "/showothertext/" + id + "/" + format;
processajax_onearg (url2,"highres");
processajax_onearg (url3,"otherres");
}
//Function to create an XMLHttp Object.
function getxmlhttp (){
//Create a boolean variable to check for a valid Microsoft ActiveX instance.
var xmlhttp = false;
//Check if we are using Internet Explorer.
try {
//If the JavaScript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older ActiveX object.
try {
//If we are using Internet Explorer.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-Internet Explorer browser.
xmlhttp = false;
}
}
// If we are not using IE, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function processajax_onearg (serverPage2,obj2){
//Get an XMLHttpRequest object for use.
xmlhttp2 = getxmlhttp();
xmlhttp2.open("GET", serverPage2);
xmlhttp2.onreadystatechange = function() {
if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
document.getElementById(obj2).innerHTML = xmlhttp2.responseText;
}
}
xmlhttp2.send(null);
} |
Il y a donc 2 appels à processajax_onearg (yen a 3 mais j'ai raccourci), qui remplacent le contenu de 2 td, seulement meme si je les nomme précisément avec un id, il semble que ces fonctions font n'importe quoi et elles remplacent le mauvais td, des fois s'inversent, ou ne font rien du tout. J'ai tenté de séparer ces fonctions en 2, comme :
<a href="javascript:showhigh(id,format);showhigh2(id,format)">
et:
1 2 3 4 5 6 7 8
| function showHigh(id,format){
var url2 = "/showhightext/" + id + "/" + format;
processajax_onearg (url2,"highres");
}
function showHigh2(id,format){
var url3 = "/showothertext/" + id + "/" + format;
processajax_onearg (url3,"otherres");
} |
Mais toujours le même problème, le td de otherres est rempli par le résultat que devait avoir highres, ou l'inverse, ou rien du tout.. Que faire? Apparemment en faisant 2 processajax_onearg différents ayant des variables différentes cela marche, mais il n'y pas plus simple?
Merci!
Partager