Recently, codemirror2 was used as the background template editor. There is no problem in ie9 and Firefox. In IE7 and IE8, the code in textarea cannot be displayed. I searched a lot and finally found the cause.
The original error code is as follows:
<P style = "margin-top: 0;">
<Asp: textbox id = "txtcontent" runat = "server" textmode = "multiline" Height = "450" width = "98%"> </ASP: textbox>
</P>
The error occurs because P in IE7 and IE8 does not support innerhtml. The author of codemirror also found this problem. Related links:
Https://github.com/marijnh/CodeMirror2/issues/215
Https://github.com/marijnh/CodeMirror2/commit/4886415d6054571f92fa4d5601ebe7d601e952ab
Try {stringwidth ("X ");}
Catch (e ){
If (E. Message. Match (/runtime/I) | E. Message. Match (/runtime/I ))
E = new error ("A codemirror inside a p-style element does not work in Internet Explorer. (innerhtml bug )");
Throw E;
}
Change P in the outer layer of textarea to Div, and then it will be normal:
<Div style = "margin-top: 0;">
<Asp: textbox id = "txtcontent" runat = "server" textmode = "multiline" Height = "450" width = "98%"> </ASP: textbox>
</Div>