---
title: "Javascript Replace innerHTML throwing Unknown Runtime Error"
author: "standalone"
date: "2011-11-30T12:18:09Z"
tags: []
categories: ["Web前端"]
slug: "javascript-replace-innerhtml-throwing-unknown-runtime-error"
draft: false
lastmod: "2011-11-30T12:18:09Z"
id: 1285503
url: "https://standalone.iteye.com/blog/1285503"
---

Quite annoying...IE sucks...

 

[http://stackoverflow.com/questions/555965/javascript-replace-innerhtml-throwing-unknown-runtime-error](http://stackoverflow.com/questions/555965/javascript-replace-innerhtml-throwing-unknown-runtime-error)

 

I encountered this problem when I want to change a table's content using el.innerHtml = '&lt;tr&gt;...&lt;/tr&gt;' in which el is a table element, IE throws "unknown runtime exception".

Finally I succeeded by adding a div as a wrapper of the table and using divEl.innerHtml  = '&lt;table&gt;&lt;tr&gt;...&lt;/tr&gt;&lt;/table&gt;'.

 

See the link you can find some explanations to this. Seems IE is more strict than FF.