Решил попробовать на деле эту штуку...
Нашёл в сети статейку с простеньким примером, стал последовательно выполнять все шаги... В результате получается только ошибка

Помогите разобраться

Вот сама страничка:
CODE:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" href="body0000.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" style="margin:0px;" marginwidth=0 marginheight=0>
<script type='text/javascript'>
var req;
function loadXMLDoc(url) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}
function processReqChange()
{
// only if req shows "complete"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
// ...processing statements go here...
response = req.responseXML.documentElement;
method = response.getElementsByTagName('method')[0].firstChild.data;
result = response.getElementsByTagName('result')[0].firstChild.data;
eval(method + '(\'\', result)');
} else {
alert("There was a problem retrieving the XML data:\n" + req.statusText);
}
}
}
function checkName(input, response)
{
if (response != ''){
// Response mode
message = document.getElementById('nameCheckFailed');
if (response == '1'){
message.className = 'error';
}else{
message.className = 'hidden';
}
}else{
// Input mode
url = './checkUserName.php?q=' + input;
loadXMLDoc(url);
}
}
</script>
<FORM ACTION="./out.php" METHOD="post" name="outform">
<input id="username" name="username" type="text" onblur="checkName(this.value,'')" />
<span class="hidden" id="nameCheckFailed">
This name is in use, please try another.
</span>
<BR><INPUT TYPE="SUBMIT" SIZE="70" NAME="out" VALUE="Выдать"> <input type="reset" value="очистить">
</FORM>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" href="body0000.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" style="margin:0px;" marginwidth=0 marginheight=0>
<script type='text/javascript'>
var req;
function loadXMLDoc(url) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}
function processReqChange()
{
// only if req shows "complete"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
// ...processing statements go here...
response = req.responseXML.documentElement;
method = response.getElementsByTagName('method')[0].firstChild.data;
result = response.getElementsByTagName('result')[0].firstChild.data;
eval(method + '(\'\', result)');
} else {
alert("There was a problem retrieving the XML data:\n" + req.statusText);
}
}
}
function checkName(input, response)
{
if (response != ''){
// Response mode
message = document.getElementById('nameCheckFailed');
if (response == '1'){
message.className = 'error';
}else{
message.className = 'hidden';
}
}else{
// Input mode
url = './checkUserName.php?q=' + input;
loadXMLDoc(url);
}
}
</script>
<FORM ACTION="./out.php" METHOD="post" name="outform">
<input id="username" name="username" type="text" onblur="checkName(this.value,'')" />
<span class="hidden" id="nameCheckFailed">
This name is in use, please try another.
</span>
<BR><INPUT TYPE="SUBMIT" SIZE="70" NAME="out" VALUE="Выдать"> <input type="reset" value="очистить">
</FORM>
</body>
</html>
В файле body0000.css присутствуют следующие строки
CODE:
span.hidden{
display: none;
}
span.error{
display: inline;
color: black;
background-color: pink;
}
display: none;
}
span.error{
display: inline;
color: black;
background-color: pink;
}
Файл checkUserName.php:
CODE:
<?php
header('Content-Type: text/xml');
function nameInUse($q)
{
if (isset($q)){
switch(strtolower($q))
{
case 'drew' :
return '1';
break;
case 'fred' :
return '1';
break;
default:
return '0';
}
}else{
return '0';
}
}
?>
<?php echo '<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>'; ?>
<response>
<method>checkName</method>
<result><?php
echo nameInUse($_GET['q']) ?>
</result>
</response>
header('Content-Type: text/xml');
function nameInUse($q)
{
if (isset($q)){
switch(strtolower($q))
{
case 'drew' :
return '1';
break;
case 'fred' :
return '1';
break;
default:
return '0';
}
}else{
return '0';
}
}
?>
<?php echo '<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>'; ?>
<response>
<method>checkName</method>
<result><?php
echo nameInUse($_GET['q']) ?>
</result>
</response>
В случае, когда в поле формы вводится fred или drew должно появлятся сообщение "This name is in use, please try another".