JavaScript DHTML/Table/Table Head

Материал из Web эксперт
Перейти к: навигация, поиск

Create Table Head

   <source lang="html4strict">
   

<html> <body> <script language="JavaScript"> function function1() {

  var m = document.all.myT.createTFoot();
  m.bgColor = "red"; 

} function function2() {

  var n = document.all.myT.createTHead();
  n.bgColor = "yellow"; 

} </script>

<thead id="th"> <tfoot id="tf">
Cell 1 Cell 2
Cell 3 Cell 4

<input type="button" value="Create tfoot" onclick="function1();"> <input type="button" value="Create thead" onclick="function2();"> </body> </html>


     </source>
   
  


Delete Table Head Example

   <source lang="html4strict">
   

<html> <body> <script language="JavaScript"> function function1() {

   document.all.myTable.deleteTFoot();

} </script>

<tfoot> </tfoot>
Row 1 Cell 1
Row 2 Cell 2
Row 3 Cell 3
TFOOT Cell 4

<input type="button" value="Remove TFOOT" onclick="function1();"> </body> </html>


     </source>
   
  


Header scope

   <source lang="html4strict">
   

<html> <body>

Row 1 Cell Cell Cell Cell info 1 Cell

<script language="JavaScript">

   document.all.myTableHeader.scope = "colgroup";

</script> <button onclick="alert("This cell provides header information for its col.");"> Cell info 1 </button> </body> </html>


     </source>
   
  


"headers" Example

   <source lang="html4strict">
   

<html> <body> <script> function function1() {

   document.getElementById("td1").headers = "hdr1";
   document.getElementById("td2").headers = "hdr2";
   document.getElementById("td3").headers = "hdr3"; 

} </script>

Item Number Item Name Item Description
28030 CD-ROM Tutorial

<input type="Button" id="b1" value="Turn Headers "on"" onClick="function1();"> </body> </html>


     </source>
   
  


"tHead" Example

   <source lang="html4strict">
   

<html> <body> <script language="JavaScript"> function function1() {

   document.all.myTable.tHead.style.backgroundColor = "blue";

} function function2() {

   document.all.myTable.tFoot.style.backgroundColor = "red";

} </script>

<thead> </thead> <tbody> </tbody> <tfoot> </tfoot>
tHead, Cell 1
tBody, Cell 2
tBody, Cell 3
tBody, Cell 4
tFoot, Cell 5

<button onclick="function1();">Turn Head Blue</button> <button onclick="function2();">Turn Foot Red</button> </body> </html>


     </source>