tags:

views:

35

answers:

3

document.getElementById('dvFile').innerHTML += txt; is not working internet explorer 7

A: 

You can only add html with +:

document.getElementById('dvFile').innerHTML = txt;

If you want previous html to be preserved, you can try this way:

document.getElementById('dvFile').innerHTML = document.getElementById('dvFile').innerHTML + txt;
Sarfraz
No still its not working
Shrikanth Hathwar
have you checked my link, lol?(with the souce code)
galambalazs
its saying unknown run time error
Shrikanth Hathwar
with more detail, you can find your answer in another thread: http://stackoverflow.com/questions/1066443/ie-innerhtml-error
galambalazs
A: 

First off you don't have a real question here. It's a statement at best. A bug report maybe.

If you want help you should provide details.

Your problem is probably because you are trying to set innerHTML of a <table> element or a<select>. Because in IE:

The innerHTML property of the TABLE, TFOOT, THEAD, and TR elements are read-only. Q239832

Things you can do include:

  • using DOM methods to add content (insertRow, insertCell)
  • using a workaround with a wrapper element

[Demo]

var txt = "<tr><td>1</td> <td>2</td></tr>";
var table = document.getElementById('table_id');
var temp  = document.createElement("div");
temp.innerHTML = "<table><tbody>" + txt + "</tbody></table>";
table.appendChild(temp.firstChild.firstChild);
galambalazs
yes i am using table is that a problem?
Shrikanth Hathwar
see my update..
galambalazs
A: 

I think, your object called dvFile is wrong type for innerHTML. dvFile must not be represented any kind of input.

Check following valid script.

<script>
function setTimeout_Testing()
{
count = 1;
document.getElementById("writeMe").innerHTML += count;
}
setTimeout("setTimeout_Testing();", 1000);
</script>

<div id="writeMe"></div>

http://www.ppshein.net/index.cfm/2010/10/18/different-between-settimeout-and-setinterval

ppshein