marcor1
19-01-2009, 18:22
Ho il file menů.js (č un menů a tendina) incluso in una pagina asp ma nella stessa pagina ho una riga ( <body onblur="showupload(data.value)"> ) che richiama una funzione in un altro file: seleziona.js
ed ho il seguente errore all'onblur della pagina:
Java script error: 'document.getElementById(...)' č nullo o non č un oggetto
le due funzioni nei 2 files vanno sicuramente in conflitto...infatti se elimino uno dei due la pagina non mi da nessun errore.
parte del codice di menů.js č:
function stgobj(id){with(document)return nIE&&nVER<5?all[id]:nNN4?layers[id]:getElementById(id);}
mentre il codice di seleziona.js č:
var xmlHttp
function showCustomer(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="getcustomer.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
prima che decida di adottare un menů in solo dhtml per evitare conflitti potreste dirmi se si puň risolvere cambiando qlcosa al codice?
ed ho il seguente errore all'onblur della pagina:
Java script error: 'document.getElementById(...)' č nullo o non č un oggetto
le due funzioni nei 2 files vanno sicuramente in conflitto...infatti se elimino uno dei due la pagina non mi da nessun errore.
parte del codice di menů.js č:
function stgobj(id){with(document)return nIE&&nVER<5?all[id]:nNN4?layers[id]:getElementById(id);}
mentre il codice di seleziona.js č:
var xmlHttp
function showCustomer(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="getcustomer.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
prima che decida di adottare un menů in solo dhtml per evitare conflitti potreste dirmi se si puň risolvere cambiando qlcosa al codice?