亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

CodeMirror2 IE7/IE8 下面未知運行時錯誤的解決方法

 更新時間:2012年03月29日 01:45:19   作者:  
最近用CodeMirror2作后臺的模板編輯器,在IE9、Firefox下面沒有問題。到了IE7、IE8下面,textarea里面的代碼就顯示不出來了。搜索了好多,終于找到原因
原來出錯的代碼如下:
復制代碼 代碼如下:

<p style="margin-top:0;">
<asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" Height="450" Width="98%"></asp:TextBox>
</p>

出錯的原因應該是IE7、IE8中的P不支持innerHTML。CodeMirror的作者也發(fā)現了這個問題,相關鏈接:
  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(/運行時/i) )
e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");
throw e;
}

把textarea外層的p改成div,即可正常:
復制代碼 代碼如下:

<div style="margin-top:0;">
<asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" Height="450" Width="98%"></asp:TextBox>
</div>
您可能感興趣的文章:

相關文章

最新評論