docume开发者_开发技巧nt.getElementById('dvFile').innerHTML += txt; is not working internet explorer 7
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
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;
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);
精彩评论