Hi!
How could I find the links (like in document.links[0] ...) from the content i retrieved through a XMLHttpRequest?
I get the error: MyThis.tempObj has no properties.
Code:
<html><head>
<script language="javascript" type="text/javascript">
MyXMLHttpRequest = function(fuURL,fuCallMeOnLoad) {
var MyThis = this;
this.status = 0; // siehe http-response-codes bzw xmlgetrequest-response-codes
this.theURL = fuURL; this.HTMLofURL = ''; this.CallMeOnLoad = fuCallMeOnLoad;
this.extractedLinks = new Array();
function onLoad (e) {
MyThis.status = 200;
MyThis.HTMLofURL = e.target.responseText;
var tempObj = e.target.responseXML; //That's not working
alert(tempObj.links[1]); // and so this gives an error
// MyThis.CallMeOnLoad(MyThis.theURL,MyThis.HTMLofURL);
}
this.LoadPage = function() {
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("Permission UniversalXPConnect denied."); }
var r = new XMLHttpRequest();
r.onload = onLoad;
r.open ("GET", this.theURL, true);
r.send (null);
}
}
function Show(t,h) {alert(t + "\n" + h);}
var Seite = new MyXMLHttpRequest('http://www.google.com',Show);
Seite.LoadPage();
</script></head><body> Hello! </body></html>
I have tried some other stuff already too, like parser, documentElement, ... but somehow responseXML is not there.
Greetings
Dieter