дело в том что у меня при нажатии на ссылки ничего не происходит!!!
вот код главной стр
CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Тест</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" >
<script type="text/javascript" src="java.js"></script>
</head>
<body>
<div class="sss">
<a onClick="callServer(null, 'test.php', null, null, showHTML, 'test')">TEST</a>
<a onClick="callServer(null, 'test2.php', null, null, showHTML, 'test')">TEST2</a>
<a onClick="callServer(null, 'test3.php', null, null, showHTML, 'test')">TEST3</a>
</div>
<div id="test">Теrtgeet странице</div>
</body>
</html>
вот код файла java.js
CODE:
<script language="JavaScript">
function showHTML(element, responseObject) {
if (typeof(element)=="string") element=document.getElementById(element);
element.innerHTML=responseObject.result;
}
function createXMLHttpRequest() {
var xmlReq = false;
// branch for native XMLHttpRequest object
if(window.XMLHttpRequest) {
try {
xmlReq = new XMLHttpRequest();
} catch(e) {
xmlReq = false;
}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
try {
xmlReq = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlReq = false;
}
}
}
return xmlReq;
}
var userAgent = { };
userAgent.isAJAX = (createXMLHttpRequest()?true:false);
userAgent.isMozilla = (navigator.userAgent.match(/\bGecko\b/));
userAgent.isOpera = (navigator.userAgent.match(/\bOpera\b/));
userAgent.isInternetExplorer = (navigator.userAgent.match(/\bMSIE\b/) && !userAgent.isOpera);
function callServer(method, url, data, dataType, func, arg) {
if (!method) method='GET';
var xmlReq = createXMLHttpRequest();
if(xmlReq) {
xmlReq.onreadystatechange = function() {
// only if xmlReq shows "loaded"
if (xmlReq.readyState == 4) {
func(arg, xmlReq.responseText, xmlReq.responseXML, xmlReq.status, xmlReq.statusText);
}
};
xmlReq.open(method, url, true);
if (data) {
if (!dataType) dataType='application/xml';
if (typeof(data)!="string" && dataType.indexOf("charset=")<0 && userAgent.isMozilla) dataType=dataType+';charset=utf-8'; // in Mozilla XML always serialized as UTF-8
xmlReq.setRequestHeader('Content-Type', dataType);
}
xmlReq.send(data);
return false;
}
return true;
}
function showHTML(element, responseText, responseXML, statusCode, statusText) {
if (typeof(element)=="string") element=document.getElementById(element);
if (statusCode==200 || statusCode==201) {
element.innerHTML=responseText;
}
else {
alert("Загрузить информацию не удалось:\n"+statusText);
}
}
</script>
а в test2.php просто текст "привет"
и никаких результатов