Differences between innertext and innerhtml:
Example:
<Div id = "test">
<Span style = "color: Red"> test1 </span> Test2
</Div>
Test. innerhtml:
That is, all content from the starting position of the object to the ending position, including HTML tags.
In the preceding example, the value of test. innerhtml is "<span style =" color: Red "> test1 </span> Test2 ".
Test. innertext:
Content from the starting position to the ending position, but it removes the HTML Tag
In the preceding example, the value of text. innertext is "test1 Test2", in which the span tag is removed.
Difference between Div and Span:
DIV is block-elements (Block-level element), and span is inline-elements (intra-Row Element ). Another difference between them is that DIV will cause line breaks, while span will not.
Tbody:
The advantage of <tbody> is that the content between <tbody> </tbody> is displayed first,
Instead of displaying the entire table after it is downloaded,
Example:
Innerhtml.html
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 strict // en"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> using responsetext with innerhtml </title>
<SCRIPT type = "text/JavaScript">
VaR XMLHTTP;
Function createxmlhttprequest (){
If (window. activexobject ){
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
Else if (window. XMLHttpRequest ){
XMLHTTP = new XMLHttpRequest ();
}
}
Function startrequest (){
Createxmlhttprequest ();
XMLHTTP. onreadystatechange = handlestatechange;
XMLHTTP. Open ("get", "innerhtml. xml", true );
XMLHTTP. Send (null );
}
Function handlestatechange (){
If (XMLHTTP. readystate = 4 ){
If (XMLHTTP. Status = 200 | XMLHTTP. Status = 0 ){
Document. getelementbyid ("Results"). innerhtml = XMLHTTP. responsetext;
<! -- Document. getelementbyid ("Results"). innertext = XMLHTTP. responsetext; -->
}
}
}
</SCRIPT>
</Head>
<Body>
<Form action = "#">
<Input type = "button" value = "Search for today's activities" onclick = "startrequest ();"/>
</Form>
<Div id = "Results"> </div>
</Body>
</Html>
Innerhtml. xml:
<Table border = "1">
<Tbody>
<Tr>
<TH> activity name </Th>
<TH> location </Th>
<TH> time </Th>
</Tr>
<Tr>
<TD> waterskiing </TD>
<TD> dock #1 </TD>
<TD> 9: 00 am </TD>
</Tr>
<Tr>
<TD> volleyball </TD>
<TD> East Court </TD>
<TD> 2: 00 PM </TD>
</Tr>
<Tr>
<TD> hiking </TD>
<TD> trail 3 </TD>
<TD> 3: 30 pm </TD>
</Tr>
</Tbody>
</Table>