Hi!
ich habe das Problem, dass ich innerhalb von "xmlRequest.onreadystatechange" die Methode test2 nicht aufrufen kann.
Folgende Fehlermeldung erhalte ich:
Opera 9.80
JavaScript - http://localhost/test.htm
Unknown thread
Error:
name: TypeError
message: Statement on line 344: Type mismatch (usually non-object value »» supplied where object required)
stacktrace: Line 344 of inline#1 script in http://localhost/test.htm
this.test2(obj);
...
Iceweasel 3.0.11
Fehler: this.test2() is not a function
Quelldatei: http://localhost/test.htm
Zeile: 352
Internet Explorer 8
Details zum Fehler auf der Webseite
Benutzer-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Zeitstempel: Wed, 8 Jul 2009 18:49:04 UTCMeldung: Das Objekt unterstützt diese Eigenschaft oder Methode nicht.
Zeile: 352
Zeichen: 15
Code: 0
URI: http://localhost/test.htm
wie muss ich die Methode test2 korrekterweise aufrufen?
gekürztes Beispiel:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de" xml:lang="de">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html, charset=utf-8" />
<script type="text/javascript">
<!--
// <![CDATA[
[code lang=javascript]function Test(){
this.test1 = function(obj){
...
xmlRequest = (window.XMLHttpRequest) ? new XMLHttpRequest() : ((window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : false);
xmlRequest.open('GET', url, true);
this.delEntries(obj);
xmlRequest.onreadystatechange = function(){
...
this.test2(obj);
}
xmlRequest.send(null);
}
this.test2 = function(obj){
alert('test2');
}
}
test = new Test();
// ]]>
//-->
</script>
</head>
<body>
<form action="">
<p><input type="button" value="test" onclick="test.test1(this);" /></p>
</form>
</body>
</html>[/code]
ps. warum werden bei den Browsern jeweils andere Zeilennummern ausgegeben?
Kristin