PDA

View Full Version : Resolved innerHTML problem (Javascript AJAX IE 8)



Abid
08-18-2009, 06:14 PM
I have been stuck on this for 2 days, my code works fine in Firefox and IE7 but in IE 8 it just crashes the browser. :confused:

The function is called via an onkeyup event on a text box. The URL brings back HTML which is passed into a DIV element called "branchresults". I have a feeling its something to do with innerHTML.



function getBranches() {

var clientID = document.getElementById("dropClients").value;
var branchNum = document.getElementById("txtBranchNum").value;
if(clientID==""){
alert("Please select a Client ");
return false

}

var strURL="ajaxgetbranches.php?client="+clientID+"&branch="+branchNum;
var req = getXMLHTTP();

if (req) {

req.onreadystatechange = function() {
if (req.readyState == 4) {

if (req.status == 200) {

rtnHTML=req.responseText;
//branchresults is a div element
document.getElementById("branchresults").innerHTML = rtnHTML;

} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
req.open("GET", strURL, true);
req.send(null);

}
}
req.open("GET", strURL, true);
req.send(null);
}
}

Abid
08-19-2009, 10:06 AM
Can anyone help me with this?

Abid
08-19-2009, 11:21 AM
I have fixed the problem how silly of me I had this line in twice:

req.open("GET", strURL, true);
req.send(null);

thenajsays
08-20-2009, 09:58 PM
can i see all of your code?

jitchavan
06-08-2010, 07:51 AM
I am just seraching around for 2 days about the innerHTML issue in IE. and found out that the HTML content assigned to innerHTML property having the problem.As html the content containg table layout causing the problem.

I replaced table layout with div layout and it is working fine on IE.