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);
}
}
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);
}
}