Debugging IE8 Javascript Replace innerHTML Runtime Error

前端 未结 10 1033
执笔经年
执笔经年 2020-12-09 17:33
function DeleteData(ID)
{
 var ctrlId=ID.id;

 var divcontents=document.getElementById(ctrlId).innerHTML;
 var tabid=ctrlId.replace(/div/,\'tab\');
 var tabcontents=         


        
10条回答
  •  渐次进展
    2020-12-09 17:56

    I find out that in IE8 some elements are in readonly: COL, COLGROUP, FRAMESET, HEAD, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR.

    Therefore if you try to set innerHTML for these elements IE8 notify alter with Unknown Runtime Error.

    More details here: http://msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx.

    The simplest way is to convert read-only elements to div element.

提交回复
热议问题