Показать сообщение отдельно
  #5 (permalink)  
Старый 19.06.2010, 15:05
Новичок на форуме
Отправить личное сообщение для PheonixS Посмотреть профиль Найти все сообщения от PheonixS
 
Регистрация: 19.06.2010
Сообщений: 6

Нужно исправить на это ?
net = {};

net.contentLoader = function (url, method){
	this.xmlHttp = null;
	this.url = url;
	this.method = method;
	
	this.error_reporting = true;
	this.loadXMLDoc(url, method);
}
net.contentLoader.prototype = {
	
	loadXMLDoc:function(url, method){
		
		try{
			this.xmlHttp = new XMLHttpRequest();
				
		}catch(e){
			var xmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
									 		"MSXML2.XMLHTTP.5.0",
											"MSXML2.XMLHTTP.4.0",
											"MSXML2.XMLHTTP.3.0",
											"MSXML2.XMLHTTP",
											"Microsoft.XMLHTTP");
			for(var i=0;i < XMLHttpVersions.length;i++){
				try{
					this.xmlHttp = new ActiveXObject(XMLHttpVersions[i]);
				}catch(e){}
			}
		}
		
		if(!this.xmlHttp && this.error_reporting)alert("Variable xmlHttp not set !");
		else if(!this.xmlHttp)return;
		
		if(this.xmlHttp){
			try{
				this.xmlHttp.open(method, url, true);
				this.xmlHttp.onreadystatechange = function (){
					if(this.xmlHttp && this.xmlHttp.readyState == 4){
						document.getElementById("kill").innerHTML = this.xmlHttp.responseText;
					}
				}
				this.xmlHttp.send(null);
			}catch(e){
				this.onError.call(e.toString());	
			}
		}
	},
	
	onError:function(e){
		if(this.error_reporting){
			alert(	"ERROR\n\n"+
					"String: " + e + 
					"Headers: " + this.xmlHttp.getAllResponseHeaders() + 
					"readystate: " + this.xmlHttp.readyState);	
		}
	}
	
}

window.onload = function (){
	new net.contentLoader("http://localhost/newphp/a.txt", "GET");
}

Только всёравно не работает
Ответить с цитированием