19 September 2008

IE innerHTML - "Unknown runtime error"

"Unknown runtime error" -- only in IE. Occur when click 'innerHTML WITH form tag'

<div id="replaceme"></div>
<div onclick="replace();return false;">innerHTML WITHOUT form tag</div><br/>
<div onclick="replace2();return false;">innerHTML WITH form tag</div>
function replace() {
document.getElementById('replaceme').innerHTML = 'REPLACED';
function replace2() {
document.getElementById('replaceme').innerHTML = '<form>REPLACED form</form>';

innerHTML supposed to supported on all major browser, http://www.quirksmode.org/dom/innerhtml.html

Current solution, don't wrap the #replaceme div in form tag

1 comment:

Armand said...

.innerHTML fails in IE on many occasions.

This link

and this one

indicate 2 of the biggest issues. maybe you have encountered another one?