0

I am trying to update an Asp.Net server side div using javascript. From the html source I get the div to look as following :

<div id="ctl02_rptCorrectiveActions_ctl03_dvCAStaff" style="overflow: auto; height: 150px; visibility: visible; background-color: red"/>

And the javascript I am trying to update the div as following ;

       try {
            var div3 = document.getElementById("ctl02_rptCorrectiveActions_ctl03_dvCAStaff");
            div3.innerHTML = "This is a test text";

        }
        catch (err) {
            var txt = "Error description: " + err.message + "\n\n";
            txt += "Click OK to continue.\n\n";
            alert(txt);
        }

When I try this I get a javascript error saying : "Unknown runtime error"

It's working ok on FF,Chrome and IE9/10 but only happens on IE8. Can anybody please shed me any light of what wrong I am doing ?

marifrahman
  • 681
  • 2
  • 13
  • 31
  • Is the "unknown runtime error" caught by the try/catch and displayed in your own alert? – nnnnnn Dec 30 '13 at 03:44
  • yes.I don get any error on the console but yeah - that's the error message I get from the catch block. – marifrahman Dec 30 '13 at 03:46
  • apply the runat=server to div and then try. – Ranjita Das Dec 30 '13 at 04:49
  • As I said it is a server side div which means runat=server is already there. What I have put here the rendered html. – marifrahman Dec 30 '13 at 04:59
  • Could it be `IE8` doesn't understand `
    ` and requires `
    ` ? (That could also depend on doctype; the former should be valid xhtml, but might be a problem for html4.)
    – towr Dec 30 '13 at 06:54
  • For this question, there is an answer already, check this out http://stackoverflow.com/questions/13817999/innerhtml-issue-in-ie8-and-below/13818214#13818214 – shivaP Dec 30 '13 at 09:04

0 Answers0