CodeMirror2 IE7/IE8 solutions for unknown run-time errors _javascript Tips

Source: Internet
Author: User
The code for the original error is as follows:
Copy Code code as follows:

<p style= "margin-top:0;" >
<asp:textbox id= "txtcontent" runat= "Server" textmode= "MultiLine" height= "450" width= "98%" ></asp:textbox >
</p>

The reason for the error should be that p in IE7, IE8 does not support innerHTML. Codemirror's authors also found the problem, RELATED links:
https://github.com/marijnh/CodeMirror2/issues/215
Https://github.com/marijnh/CodeMirror2/commit/4886415d6054571f92fa4d5601ebe7d601e952ab
Copy Code code as follows:

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

TextArea the outer layer of P into Div, you can be normal:
Copy Code code as follows:

<div style= "margin-top:0;" >
<asp:textbox id= "txtcontent" runat= "Server" textmode= "MultiLine" height= "450" width= "98%" ></asp:textbox >
</div>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.