Debugging IE8 Javascript Replace innerHTML Runtime Error

前端 未结 10 998
执笔经年
执笔经年 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:38

    Great, I had the same situation with setting the innerHTML. When I read this I realised that one of the elements was a TR and one was a TD and the TD was working.

    Changing the code so that they're both TDs fixes it, which means that it is a rather non-obvious problem caused by the structure of tables.

    Presumably it throws the DOM awry when I start changing table rows since it can't store the table as an array any more.

    I'm sure IE could give a more informative error message since it can't be that uncommon for the DOM to change on the fly and it seems strange that this would only throw an error for tables.

提交回复
热议问题