473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

AJAX-DOM: problemi con select dinamiche in IE7

Salve a tutti.
Ho un problema con IE7.

Ho implementato una pagina .asp che tramite tecnologia AJAX mi crea una
serie di select nidificate (il classico esempio delle Regioni-Province
--scelgo dalla prima select una regione d'Italia e popolo
dinamicamente la seconda select con le province corrispondenti).

Tutto questo funziona perfettamente con FireFox.
Mi sono accorto poi che su Internet Explorer 7 invece non funziona per
niente (?).

Io ho implementato una pagina .asp che richiama un file .js (dove
tramite AJAX popolo le mie select) utilizzando come webserver IIS.
Utilizzo Windows XP come S.O.

Su internet non ho trovato nulla che potesse aiutarmi a capire questo
strano problema.

Dalla mia umile esperienza direi che si tratta di qualche errore di
sintassi a livello di javascript che IE7 non riesce a risolvere.
Il fatto è che la mia pagina .js (utilizzo anche il DOM) l'ho
strutturata basandomi sullo standard del W3C
(http://www.w3schools.com/) ma potrei ovviamente aver dimenticato
qualcosa.

Suggerimenti?

La struttura della mia applicazione è questa:
1) pagina default.asp che contiene le select dinamiche con valori
prelevati da un database;
2) nell'evento ONCHANGE di ogni select richiamo una funzione javascript
che implementa la tecnologia AJAX: --creo l'oggetto xmlHttpRequest
....
xmlHttp = getXmlHttpObject())
xmlHttp.onreadystatechange = stateChanged; //funzione da richiamare
quando cambia lo stato dell'oggetto
var url = "cerca.asp"; //mi restituirà le OPTION della select figlio
xmlHttp.open("GET", url + "?idpadre=" + ID, true);
xmlHttp.send(null);
....
// funzione che ricava l'oggetto in base al browser dell'utente
function getXmlHttpObject()
{
var objXmlHttp = null;
if(window.XMLHttpRequest)
{
objXmlHttp = new XMLHttpRequest(); // code for Mozilla, etc.
}
else if(window.ActiveXObject)
{
objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); // code for IE7
?!?!?
}
return objXmlHttp;
}
....
// funzione da eseguire quando cambia lo stato dell'oggetto
function stateChanged()
{
....
//visualizzo il risultato del file aperto con l'oggetto xmlHttp
document.getElementById(SelectName).innerHTML = xmlHttp.responseText;
....
}

3) il file cerca.asp esegue una query sul database estrapolando tutti i
record figli della select selezionata --in pratica con una serie di
Response.Write stampo le varie OPTION;

Forse non è un problema di oggetti in quanto facendo la ResponseText
del mio httpRequest i dati delle select li visualizzo... quindi deduco
che l'oggetto venga creato correttamente sia su FireFox che su IE7....
Nella mia funzione:

// funzione che ricava l'oggetto in base al browser dell'utente
function getXmlHttpObject()
{
var objXmlHttp = null;
// code for Mozilla, etc.
if(window.XMLHttpRequest)
{
alert('MOZILLA');
objXmlHttp = new XMLHttpRequest()
}
// code for IE
else if(window.ActiveXObject)
{
alert('IE');
objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
}
return objXmlHttp;
}

stampo sempre MOZILLA sia su fireFox che su IE7. Questo perchè (credo)
entrambi i browser utilizzano l'oggetto XMLHttpRequest più standard e
indipendente.

Detto ciò, il problema continua a restare però.... :-(

Grazie e buona giornata a tutti.

Luigi.

Jan 16 '07 #1
1 6331
ASM
di*********@gmail.com a écrit :
[snip]
La struttura della mia applicazione è questa:
1) pagina default.asp che contiene le select dinamiche con valori
prelevati da un database;
2) nell'evento ONCHANGE di ogni select richiamo una funzione javascript
che implementa la tecnologia AJAX: --creo l'oggetto xmlHttpRequest
...
xmlHttp = getXmlHttpObject())
xmlHttp.onreadystatechange = stateChanged; //funzione da richiamare
quando cambia lo stato dell'oggetto
var url = "cerca.asp"; //mi restituirà le OPTION della select figlio
xmlHttp.open("GET", url + "?idpadre=" + ID, true);
Après l'italien, un peu d'espagnol ?

de donde viene este ID ?
xmlHttp.send(null);
...
// funzione che ricava l'oggetto in base al browser dell'utente
Mirar luego (see bellow)
...
// funzione da eseguire quando cambia lo stato dell'oggetto
function stateChanged()
{
...
//visualizzo il risultato del file aperto con l'oggetto xmlHttp
document.getElementById(SelectName).innerHTML = xmlHttp.responseText;
como no se que es este SelectName ...
Is it a select tag ?
If yes, on my idea you cannot innerHTML all your options this way,
but I can make a mistake ...
...
}

3) il file cerca.asp esegue una query sul database estrapolando tutti i
record figli della select selezionata --in pratica con una serie di
Response.Write stampo le varie OPTION;

Forse non è un problema di oggetti in quanto facendo la ResponseText
del mio httpRequest i dati delle select li visualizzo... quindi deduco
che l'oggetto venga creato correttamente sia su FireFox che su IE7....
Nella mia funzione:

// funzione che ricava l'oggetto in base al browser dell'utente
function getXmlHttpObject() {
var http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
}
else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
if (!http_request) {
alert('Abandon : Impossible de créer une instance XMLHTTP');
return false;
}
else alert('tutti va bene');
return http_request;
}
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
4
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
2
by: Alex | last post by:
Example uploaded to: http://www.clickatus.com/ajax/ BTW - This is for FIREFOX, won't work in IE. I don't know why but when it is executed the browser still in loading state... Even though...
7
by: Thirsty Traveler | last post by:
Peter Bromberg has an interesting article eggheadcafe discussing AJAX libraries. He prefers ANTHEM.NET over AJAX.NET because it doesn't break the stateful page model. Our developers are currently...
5
by: darrel | last post by:
I've been playing with prototype.js and scriptaculous to create some nice drag-and-drop interaction on my applications GUI. That's working well. Now I want to take the next step and start passing...
1
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
10
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
controlsPlease could some of you here post some of your live examples of AJAX (esp drag panels, collapsable panels, and popup menu.) (It's one thing to talk about how great something is, but it's...
2
by: soni2926 | last post by:
hi, does anyone know of any good books on ajax and asp.net, one that teaches ajax itself before jumping in atlas? I wanted to get an understanding of ajax and how to use it, most books i've seen...
6
by: Scott M. | last post by:
What is the version number of AJAX when we talk about ASP .NET AJAX in VS 2008?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.