<?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>
<title>Ajax 1</title>
<meta http-equiv="Content-Type" content="text/xml; charset=utf-8" />
<style type="text/css" media="screen">

</style>

<script type="text/javascript">
<![CDATA[

function XMLDoc() {
	var me = this;
	var req = null;
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}
	
	this.request = req;
	this.loadXMLDoc = function (url, handler) {
		if (this.request) {
			this.request.open ("GET", url, true);
			this.request.onreadystatechange = function () {
				handler(me);
			};
			this.request.setRequestHeader("Content-Type", "text/xml");
			this.request.send(null);
		}
	};
}

function initXML () {
	var newrequest = new XMLDoc();
	newrequest.loadXMLDoc("xml/data.xml", showData);
}

function showData(req) {
	req = req.request;
	var body = document.getElementsByTagName("body")[0];
	if (req.readyState == 4 && req.status == 200) {
	
		var title = req.responseXML.getElementsByTagName("title")[0];
		var p = document.createElement("p");
		body.appendChild(p);
		var content = document.createTextNode(title.firstChild.nodeValue);
		p.appendChild(content);
		
		
	}
}

window.onload = initXML;
			



]]>

</script>

</head>

<body>

<p>The paragraph below should contain the string &quot;CSS Test&quot;.</p>




</body>
</html>

