Ho provato come hai detto te ma non va...poi ho provato così
Codice PHP:
function lib_xml_initialize() {
this.obj=null;
this.Loading="Loading...";
this.Writer="mypage";
try {
// Firefox, Opera 8.0+, Safari
this.obj=new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
this.obj=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
this.obj=new ActiveXObject("Microsoft.XMLHTTP");
}
}
this.Page=function () {
if (this.obj.readyState==0) {//Uninitialized
//
}
if (this.obj.readyState==1) {//Loading
document.getElementById(this.Writer).innerHTML=this.Loading;
}
if (this.obj.readyState==2) {//Loaded
//
}
if (this.obj.readyState==3) {//Interactive
//
}
if (this.obj.readyState==4) {//Complete
document.getElementById(this.Writer).innerHTML=this.obj.responseText;
}
}
this.AdvancedLoad=function (tipo,surl,async,tosend,user,pass) {
if (this.obj==null) {
alert("Your browser doesn't support XMLHTTP");
return false;
}
try {
this.obj.onreadystatechange=function () {
if (this.obj.readyState==0) {//Uninitialized
//
}
if (this.obj.readyState==1) {//Loading
document.getElementById(this.Writer).innerHTML=this.Loading;
}
if (this.obj.readyState==2) {//Loaded
//
}
if (this.obj.readyState==3) {//Interactive
//
}
if (this.obj.readyState==4) {//Complete
document.getElementById(this.Writer).innerHTML=this.obj.responseText;
}
}
this.obj.open(tipo,surl,async,user,pass);
this.obj.send(tosend);
return true;
} catch(e) {
alert("Problems in loading the page");
return false;
}
return true;
}
this.Load=function (tipo,surl,async,tosend) {
if (this.obj==null) {
alert("Your browser doesn't support XMLHTTP");
return false;
}
try {
this.obj.onreadystatechange=function () {
if (this.obj.readyState==0) {//Uninitialized
//
}
if (this.obj.readyState==1) {//Loading
document.getElementById(this.Writer).innerHTML=this.Loading;
}
if (this.obj.readyState==2) {//Loaded
//
}
if (this.obj.readyState==3) {//Interactive
//
}
if (this.obj.readyState==4) {//Complete
document.getElementById(this.Writer).innerHTML=this.obj.responseText;
}
}
this.obj.open(tipo,surl,async);
this.obj.send(tosend);
return true;
} catch(e) {
alert("Problems in loading the page");
return false;
}
return true;
}
this.EasyLoad=function (surl) {
return this.Load("GET",surl,true,null);
}
}
E in un html ho fatto
codice:
<html>
<head>
<script language="javascript" type="text/javascript" src="lib_xml.js"></script>
</head>
<body>
<input type="button" OnMouseUp="javascript:XmlEasyLoad(k,'read.xml');" value="P1" />
<input type="button" OnMouseUp="javascript:p2();" value="P2" />
<input type="button" OnMouseUp="javascript:p3();" value="P3" />
<div id="mypage">
Prima di effettuare il cambio pagina
</div>
<div id="my2page">
Posto per altre cose
</div>
<script language="javascript" type="text/javascript">
var xmlObj=new lib_xml_initialize();
xmlObj.EasyLoad("read.xml");
</script>
</body>
</html>
ma l'errore è sempre lo stesso: this.obj has no properties!
dio santo...così non ho modo di creare un oggetto che mi faccia da standard...