Post back gives iexplore.exe error w/ ASP.NET v1.1
-
Hello! I can type in the value in one text box, then it'll go to the code behind of another page and do the correct functionality....which will tell the user if the number is distinct or not. The only problem is when I post back the page via the button_click event, I get an IE error, iexplore.exe error, The instruction at "0x4a594476" referenced memory at "0x00000004". The memory could not be "read". HTML code is: WebForm1 var xmlHttp = createXmlHttpRequestObject(); function createXmlHttpRequestObject() { var xmlHttp; if(window.ActiveXObject) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlHttp = false; } } else { try { xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp = false; } } if (!xmlHttp) { alert("Error creating the XMLHttpRequest object."); } else { return xmlHttp; } } function process() { varWBS = encodeURIComponent(document.getElementById("TextBox1").value); xmlHttp.open("GET", "test.aspx?WBS=" + varWBS); xmlHttp.onreadystatechange = handleServerResponse; xmlHttp.send(null); } function handleServerResponse() { //if (xmlHttp.readyState == 4 && xmlHttp.status == 200) //{ // document.getElementById("show").innerHTML = xmlHttp.responseText; //} //} //New code if (xmlHttp.readyState == 4) { if(xmlHttp.status == 200) { var parentElement = document.getElementById('show'); var wrappingDiv = document.createElement('div'); wrappingDiv.innerHTML = document.getElementById("TextBox1").value+' '+xmlHttp.responseText; parentElement.appendChild(wrappingDiv); //document.getElementById("show").innerHTML = xmlHttp.responseText; //document.all[show].innerHTML = xmlHttp.responseText; } else { alert("hmmmm"); } </x-turndown>
-
Hello! I can type in the value in one text box, then it'll go to the code behind of another page and do the correct functionality....which will tell the user if the number is distinct or not. The only problem is when I post back the page via the button_click event, I get an IE error, iexplore.exe error, The instruction at "0x4a594476" referenced memory at "0x00000004". The memory could not be "read". HTML code is: WebForm1 var xmlHttp = createXmlHttpRequestObject(); function createXmlHttpRequestObject() { var xmlHttp; if(window.ActiveXObject) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlHttp = false; } } else { try { xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp = false; } } if (!xmlHttp) { alert("Error creating the XMLHttpRequest object."); } else { return xmlHttp; } } function process() { varWBS = encodeURIComponent(document.getElementById("TextBox1").value); xmlHttp.open("GET", "test.aspx?WBS=" + varWBS); xmlHttp.onreadystatechange = handleServerResponse; xmlHttp.send(null); } function handleServerResponse() { //if (xmlHttp.readyState == 4 && xmlHttp.status == 200) //{ // document.getElementById("show").innerHTML = xmlHttp.responseText; //} //} //New code if (xmlHttp.readyState == 4) { if(xmlHttp.status == 200) { var parentElement = document.getElementById('show'); var wrappingDiv = document.createElement('div'); wrappingDiv.innerHTML = document.getElementById("TextBox1").value+' '+xmlHttp.responseText; parentElement.appendChild(wrappingDiv); //document.getElementById("show").innerHTML = xmlHttp.responseText; //document.all[show].innerHTML = xmlHttp.responseText; } else { alert("hmmmm"); } </x-turndown>
The error may have been caused by this part of your code:
var parentElement = document.getElementById('show');
var wrappingDiv = document.createElement('div');
wrappingDiv.innerHTML = document.getElementById("TextBox1").value+' '+xmlHttp.responseText;
parentElement.appendChild(wrappingDiv);Try appending the div to the parent element first before setting the value, and you may want to use innerText instead of innerHTML. Also, is your xmlHttp.responseText a HTML script? If yes, that might be the cause of the problem. You're better off writing your html via javascript than setting it via innerHTML property. "You are special, but so is everybody else." "Democracy is two wolves and a sheep voting on what to have for dinner" - Ross Edbert Sydney, Australia