In IE browser
Object. innerhtml
Is all content from the starting position of the object to the ending position, including HTML tags
Innertext
Content from the starting position of the object to the ending position, but it removes the HTML Tag
Outerhtml
In addition to all the content of innerhtml, it also contains the object tag itself
<Table id = "testtab" width = "200" border = "1">
<Tr>
<TD> <font color = "# ff0000"> DH </font> </TD>
<TD> </TD>
</Tr>
</Table>
<Script language = "JavaScript">
Function $ (ID)
{
Return document. getelementbyid (ID );
}
VaR objtesttab = $ ("testtab ");
Alert ("innerhtml:" + objtesttab. Rows [0]. cells [0]. innerhtml)
Alert ("innertext:" + objtesttab. Rows [0]. cells [0]. innertext)
Alert ("outerhtml:" + objtesttab. Rows [0]. cells [0]. outerhtml)
Note:
Innerhtml is applicable to IE and Firefox,
Nnertext is only applicable to IE. To implement this result in Firefox, use textcontent.
Outerhtml is only applicable to IE. If you want to use it in Firefox, you have to write your own method. Search for it!