andistroebi
Goto Top

readyState ist bei IE undefined

Ich habe das Problem das ich bei this.readyState (Zeile 37) bei IE nur undefined bekomme, bei Firefox komme ich die normalen Werte von 1-4

an was liegt das??

function ajax(feld)
{
	this.feld = feld;
	this.http = createObject();
	this.zeilen = 0;
	this.index = 0;
	this.mouse = true;
	this.mousover = false;
	
	this.constructor = ajax;
	this.autosuggest = autosuggest;
	this.autosuggestReply = "";  
};
//--------------------------------------------------------------------------
function createObject() 
{
	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer")  
	{
		request_type = new ActiveXObject("Microsoft.XMLHTTP");  
	}
	else
	{
		request_type = new XMLHttpRequest();
	}
	return request_type;
};
//--------------------------------------------------------------------------
function autosuggest(keycode) 
{	
	if(keycode>46)
	{
		var klasse = this;
		this.autosuggestReply = function()
			{ 	
			  alert(this.readyState);
			  if(this.readyState == 4)
			  {
				  var response = this.responseText;
				  document.getElementById("test").value = response;  
				  e = document.getElementById("results" + klasse.feld);  
				  if(response!="")  
				  {
					  e.innerHTML=response;
					  e.style.display = "block";  
					  klasse.zeilen = document.getElementById("zeilen" + klasse.feld).value;  
					  klasse.index = 0;
				  }
				  else
				  {
					  e.style.display = "none";  
				  }
			  }
			};
		q = document.getElementById('feld' + this.feld).value;  
		nocache = Math.random();
		this.http.open('get', 'lib/search.php?feld='+this.feld+'&q='+q+'&nocache = '+nocache);  
		this.http.onreadystatechange = this.autosuggestReply;
		this.http.send(null);
	}
};

Content-ID: 113089

Url: https://administrator.de/contentid/113089

Ausgedruckt am: 23.11.2024 um 02:11 Uhr