Hallo,
per Ajax lade ich ein HTML-Dokument in die Variable checkResponseXML:
try {
var http = null;
if (window.XMLHttpRequest) {
http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
http = new ActiveXObject("Microsoft.XMLHTTP");
}
if (http != null) {
http.open("GET", completeUrl, false);
http.onreadystatechange = function () {
if (http.readyState == 4) {
checkResponseXML = http.responseXML;
}
}
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http.send();
}
} catch(e) {
}
Das Ergebnis von checkResponseXML ist ein gültiges HTML-Dokument mit Doctype-Deklaration:
<?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">
<head>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Index</title>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta name="keywords" content=""/>
<meta name="description" content=""/>
<link rel="stylesheet" href="http://127.0.0.1/css/screenbasic.css" type="text/css"/>
</head>
<body>
<div id="additionalnav">
<ul class="obligatory">
<li class="obligatory">
<a href="#">Impressum</a>
</li>
<li class="obligatorysep">|</li>
<li class="obligatory">
<a href="#">Kontakt</a>
</li>
</ul>
</div>
</body>
</html>
var newAdditionalnavNav = checkResponseXML.getElementById("additionalnav");
FF kann mit getElementById auf Elemente des HTML-Dokuments zugreifen, InternetExplorer (8) nicht...
IE8: Object doesn't support this property or method
Kann man checkResponseXML noch irgendwie umwandeln, damit das auch der IE kann?
Viele Grüße
Siri