|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Apr 2006
Messaggi: 123
|
[Javascript]problema con getElementById
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 è: Codice:
function stgobj(id){with(document)return nIE&&nVER<5?all[id]:nNN4?layers[id]:getElementById(id);}
Codice:
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;
}
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 06:13.



















