hi i wrote a simple ajax script its working and i don`t know why can any one here can help me?
when we place a mouse on a link then it shows that page
this is my basicajax.php page
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ajax</title>
<link rev="stylesheet" rel="stylesheet" href="style1.css">
<script src="script.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="index.php">praveen</a></li>
<li><a href="get1.php">kumar</a></li>
<li><a href="order.html">goud</a></li>
</ul>
<div id="previewWin"> </div>
</body>
</html>
and this is my script.js file
window.onload= initAll;
var xhr=false;
var xpos,ypos;
function initAll(){
var alllinks=document.getElementByTagName("a");
for(var i=0;i<alllinks.length;i++){
alllinks[i].onmouseover=showPreview;
}
}
function showPreview(evt){
if(evt){
var url=evt.target;
}
else {
evt=window.event;
var url=evt.srcElement;
}
xpos=evt.clientx;
ypos=evt.clienty;
if(window.XMLHttpRequest) {
xhr=newXMLHttpRequest();
}
else {
if(window.ActiveXobject) {
try{
xhr=new ActiveXobject("microsoft.XMLHttp")
}
catch(e) {
}
}
}
if(xhr){
xhr.onreadystatechange=showcontents;
xhr=open("GET",url,true);
xhr.send(null);
}
else {
alert("sorry");
}
}
function showcontents(){
if(xhr.readystate==4){
if(xhr.status==200){
var outmsg=xhr.responseText;
}
else{
var outmsg ="there was a error"+xhr.status;
}
var prevwin=document.getElementById("previewWin");
prevWin.innetHTML=outmsg;
prevWin.style.top=parseInt(ypos)+2+ "px";
prevWin.style.left=parseInt(xpos)+2+ "px";
prevWin.style.visibility="visible";
prevWin.onmouseout=function(){
document.getElementById("previewWin").style.visibility="hidden";
}
}
}
and this my style sheet
li a {
text-decoration:none;
font-weight:bold;
}
li a:hover{text-decoration:underline;
}
h2,ul { font-family:Georgia, "Times New Roman", Times, serif;
}
li { list-style-type:none;
}
#previewWin{
background-color:#ff9;
width:150px;
height:200px;
font:6em Arial, Helvetica, sans-serif;
padding:5px;
position:absolute;
visibility:hidden;
border:1px #solid;
overflow:hidden;
}
#previewWin h1, #previewWin h2{
font-size:1.0em;
}
i dont understand why this is not working