I try to learn Ajax so I start with a simple page; i parse a text from a file.It is working in FF but not in IE.I use catch and try method of creating an instance of the object, until one such method succeeds.I try also with window.*** but not working
java script
Code:
function getXMLHTTPRequest()
{
var request = false;
try
  {
    request = new XMLHttpRequest(); // Firefox
  }
catch(err1)
  {
  try
    {
    request = new ActiveXObject("Msxml2.XMLHTTP");
  // IE new
    }
  catch(err2)
    {
    try
      {
      request = new ActiveXObject("Microsoft.XMLHTTP");
//Ie old
      }
      catch(err3)
        {
        request = false;
        }
    }
  }
return request;
}

/////////////////////////////
var myreq = getXMLHTTPRequest();

function callAjax(){
if(myreq) {
var url = "vsl.txt";
myreq.open("GET", url);
myreq.onreadystatechange = function()
{
if (myreq.readyState == 4 && myreq.status == 200) {
document.getElementById("tara").innerHTML =myreq.responseText;
}
}
myreq.send(null);
}
}
HTML
Code:
<div id="tara"></div>

<div id="Layer1">
  <input type="button" name="Button" value="Button" onclick="callAjax()"/>