Copy Code code as follows:
<script>
document.getElementById ("Trone"). InnerHTML = "<td>haha</td>";
</script>
<tr id= "Trone" >
</tr>
In IE, there are sometimes "unknown run-time errors" (Unknown runtime error), but not in Firefox.
This is mainly the case of IE in the write operation of the innerHTML will check whether the element has to do as the content of the HTML object container requirements, such as if you are in a P containing <li> HTML code, this will be wrong. So if you find these errors appearing, try to do two things:
1, check your attempt to add to the innerHTML HTML code contains broken HTML tags, such as no <ul></ul> surrounded by <li></li>
2, change your container to those more "inclusive" label, such as <span></span>,<div></div>
The special note is that the <tbody>,<table>,<tr> tags in the correct format <td> tags may be wrong, so you should avoid using these labels as a container, if necessary, can use <td> as a container , and then nest a layer of tables.
So, if it is
<TD id= "Trone" ></td> use document.getElementById ("Trone"). innerhtml= "new"; no problem.
Workaround you can dynamically create <tr><td> tags with javascript, instead of using innerHTML to change directly.