这是我的麻省法典。
function sendAjax(send_data,id)
{
var ajaxobj;
alert("After this alert problem occurs!");
if (window.XMLHttpRequest) ajaxobj = new XMLHttpRequest();
else ajaxobj = new ActiveXObject("Microsoft.XMLHTTP");
ajaxobj.onreadystatechange=function()
{
if(ajaxobj.readyState==4)
{
if(ajaxobj.responseText.match("confirmPage") != null) document.getElementById(id).innerHTML = ajaxobj.responseText;
else
{
if(id == "FreshContent")
document.getElementById(id).innerHTML = "<a id="refreshpage" onClick="siteSelection( select )">Failed.Click here to Reload!</a>";
else
document.getElementById(id).innerHTML = "<a id="refreshpage" onClick="sendAjax(0, latest_gossip_marquee );">Failed.Click here to Reload!</a>";
}
}
else document.getElementById(id).innerHTML="Loading....";
}
if(id == "FreshContent") ajaxobj.open("GET","sitexyz.php?"+send_data,true);
else ajaxobj.open("GET","html/xyz.html",true);
ajaxobj.send();
}
Here the FreshContent is a div tag id.it works in opera & firefox but it crashes in my IE7. to see if the page returned by the server is valid the code checks if the returned page has confirmPage string in it.