Rechercher : dans
Par :

Ajax incompatible IE6

Dernière réponse le 30 jui 2009 à 17:04:31 kissi, le 25 fév 2009 à 18:40:19 
 Signaler ce message aux modérateurs

Bonjour,

Je suis actuellement en train de créer un site , et je souhaitais intégrer un menu déroulant en ajax.

J'ai cependant un problème : celui ne fonctionne pas avec Internet Explorer 6 (à noter : aucun problème avec firefox et IE7).

Voici la page ajax:


function sack(file) {
this.xmlhttp = null;

this.resetData = function() {
this.method = "POST";
this.queryStringSeparator = "?";
this.argumentSeparator = "&";
this.URLString = "";
this.encodeURIString = true;
this.execute = false;
this.element = null;
this.elementObj = null;
this.requestFile = file;
this.vars = new Object();
this.responseStatus = new Array(2);
};

this.resetFunctions = function() {
this.onLoading = function() { };
this.onLoaded = function() { };
this.onInteractive = function() { };
this.onCompletion = function() { };
this.onError = function() { };
this.onFail = function() { };
};

this.reset = function() {
this.resetFunctions();
this.resetData();
};

this.createAJAX = function() {
try {
this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
try {
this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
this.xmlhttp = null;
}
}
if (! this.xmlhttp) {
if (typeof XMLHttpRequest != "undefined") {
this.xmlhttp = new XMLHttpRequest();
} else {
this.failed = true;
}
}
};

this.setVar = function(name, value){
this.vars[name] = Array(value, false);
};

this.encVar = function(name, value, returnvars) {
if (true == returnvars) {
return Array(encodeURIComponent(name), encodeURIComponent(value));
} else {
this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
}
}

this.processURLString = function(string, encode) {
encoded = encodeURIComponent(this.argumentSeparator);
regexp = new RegExp(this.argumentSeparator + "|" + encoded);
varArray = string.split(regexp);
for (i = 0; i < varArray.length; i++){
urlVars = varArray[i].split("=");
if (true == encode){
this.encVar(urlVars[0], urlVars[1]);
} else {
this.setVar(urlVars[0], urlVars[1]);
}
}
}

this.createURLString = function(urlstring) {
if (this.encodeURIString && this.URLString.length) {
this.processURLString(this.URLString, true);
}

if (urlstring) {
if (this.URLString.length) {
this.URLString += this.argumentSeparator + urlstring;
} else {
this.URLString = urlstring;
}
}

// prevents caching of URLString
this.setVar("rndval", new Date().getTime());

urlstringtemp = new Array();
for (key in this.vars) {
if (false == this.vars[key][1] && true == this.encodeURIString) {
encoded = this.encVar(key, this.vars[key][0], true);
delete this.vars[key];
this.vars[encoded[0]] = Array(encoded[1], true);
key = encoded[0];
}

urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
}
if (urlstring){
this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
} else {
this.URLString += urlstringtemp.join(this.argumentSeparator);
}
}

this.runResponse = function() {
eval(this.response);
}

this.runAJAX = function(urlstring) {
if (this.failed) {
this.onFail();
} else {


this.createURLString(urlstring);
//this.createURLString(this.requestFile);

if (this.element) {
this.elementObj = document.getElementById(this.element);
}
if (this.xmlhttp) {
var self = this;
if (this.method == "GET") {
totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
this.xmlhttp.open(this.method, totalurlstring, true);
} else {
this.xmlhttp.open(this.method, this.requestFile, true);
try {
this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
} catch (e) { }
}

this.xmlhttp.onreadystatechange = function() {

switch (self.xmlhttp.readyState) {
case 1:
self.onLoading();
break;
case 2:
self.onLoaded();
break;
case 3:
self.onInteractive();
break;
case 4:
self.response = self.xmlhttp.responseText;
self.responseXML = self.xmlhttp.responseXML;
self.responseStatus[0] = self.xmlhttp.status;
self.responseStatus[1] = self.xmlhttp.statusText;

if (self.execute) {
self.runResponse();
}

if (self.elementObj) {
elemNodeName = self.elementObj.nodeName;
elemNodeName.toLowerCase();
if (elemNodeName == "input"
|| elemNodeName == "select"
|| elemNodeName == "option"
|| elemNodeName == "textarea") {
self.elementObj.value = self.response;
} else {
self.elementObj.innerHTML = self.response;
}
}
if (self.responseStatus[0] == "200") {
self.onCompletion();
} else {
self.onError();
}

self.URLString = "";
break;
}
};
this.xmlhttp.send(this.URLString);
}
}

};

this.reset();
this.createAJAX();
}





var ajax = new sack();

function getDropModelList(sel,admin)
{

var firstCode = sel.options[sel.selectedIndex].value;
document.getElementById('model').options.length = 0; // Empty second select box

if(firstCode.length>0){
//if call from admin then make sure front end file is called
if(admin){
ajax.requestFile = '../index2.php?option=com_ezautos&task=helpers&id=1&no_html=1&firstCode='+firstCode; // Specifying which file to get
}else{
ajax.requestFile = 'index2.php?option=com_ezautos&task=helpers&id=1&no_html=1&firstCode='+firstCode; // Specifying which file to get
}

ajax.onCompletion = createSecond; // Specify function that will be executed after file has been found
ajax.runAJAX(); // Execute AJAX function
}
}

function createSecond()
{
var obj = document.getElementById('model');
eval(ajax.response); // Executing the response from Ajax as Javascript code

}


function getDropModelList2(sel,admin)
{

var firstCode2 = sel.options[sel.selectedIndex].value;
document.getElementById('model2').options.length = 0; // Empty second select box

if(firstCode2.length>0){
//if call from admin then make sure front end file is called
if(admin){
ajax.requestFile = '../index2.php?option=com_ezautos&task=helpers&id=1&no_html=1&firstCode='+firstCode2; // Specifying which file to get
}else{
ajax.requestFile = 'index2.php?option=com_ezautos&task=helpers&id=1&no_html=1&firstCode='+firstCode2; // Specifying which file to get
}

ajax.onCompletion = createSecond2; // Specify function that will be executed after file has been found
ajax.runAJAX(); // Execute AJAX function
}
}

function createSecond2()
{
var obj = document.getElementById('model2');
eval(ajax.response); // Executing the response from Ajax as Javascript code

}


function getDropModelList3(sel,admin)
{

var firstCode3 = sel.options[sel.selectedIndex].value;
document.getElementById('model3').options.length = 0; // Empty second select box

if(firstCode3.length>0){
//if call from admin then make sure front end file is called
ajax.requestFile = 'index2.php?option=com_ezautos&task=helpers&id=1&no_html=1&firstCode='+firstCode3; // Specifying which file to get

ajax.onCompletion = createSecond3; // Specify function that will be executed after file has been found
ajax.runAJAX(); // Execute AJAX function
}
}

function createSecond3()
{
var obj = document.getElementById('model3');
eval(ajax.response); // Executing the response from Ajax as Javascript code

}


Merci de m'aider

Configuration: Windows XP
Firefox 3.0.6

Meilleures réponses pour « ajax incompatible IE6 » dans :
AJAX (Asynchronous Javascript And XML) Voir Introduction à AJAX AJAX (Asynchronous Javascript And XML, traduisez Javascript asynchrone et XML) est une méthode de développement web basée sur l'utilisation d'un script Javascript pour effectuer des requêtes web à l'intérieur d'une page web...
[mythes] ZoneAlarm et Avast sont incompatibles VoirMythe ZoneAlarm et Avast sont incompatibles. Il ne faut pas les installer ensemble. Réalité FAUX. Explications Quand vous installez Avast après ZoneAlarm, vous avez sûrement dû voir une fenêtre d'avertissement concernant un problème de...
Vista et AOL 9.0 incompatible VoirLors de l'acquisition d'un PC avec Vista installé comme système d'exploitation, vous vous rendrez compte que la version d'AOL 9.0 (ou versions antécédentes) n'est pas compatible avec celui ci. Le fournisseur d'accès a mis en place une...
Télécharger Power IE6 VoirPower IE 6 est compatible avec Internet Explorer 7, c'est un logiciel d'origine canadienne, qui vous permet en quelques clics de rendre vos surfs plus discret : Nouvelles fonctionnalités : Le logiciel est désormais multilingue, et...
AJAX (Asynchronous Javascript And XML) VoirAvantages liés à AJAx Les sites web utilisant AJAX bénéficient des avantages suivants : Une interface réactive car AJAX permet de modifier localement la page web ; Une rapidité d'exécution car seules les données à modifier dans la page sont...
AJAX (Asynchronous Javascript And XML) VoirAvantages liés à AJAx Les sites web utilisant AJAX bénéficient des avantages suivants : Une interface réactive car AJAX permet de modifier localement la page web ; Une rapidité d'exécution car seules les données à modifier dans la page sont...

1

sisco, le 26 fév 2009 à 10:51:59

Slt a tous,
moi également j'ai le même problème et je ne trouve pas de résolution.
si kelkun a une idée sur le problème.nous lui remercions de nous faire part.
cordialement

Répondre à sisco

2

 phenX, le 30 jui 2009 à 17:04:31

Idem
pas de solution

dès je met de l'ajax, ou juste du JS y a plus rien qui marche sur IE6

Répondre à phenX