JavaScript Reference/Javascript Methods/createCaption

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

"createCaption()" Example

   <source lang="javascript">
   

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

   var myC = document.getElementById("myTable").createCaption();
   myC.innerText = "This is the new caption text";

} </script>

This table has no caption

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


     </source>
   
  


"createCaption()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+

| Applied_To | | +----------------+--------------------------------------------------------------+ </source>

"createCaption()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Creates a

element associated with the specified table. The contents of the <caption> must also be set at run time.

Syntax:

document.getElementById("tableID").createCaption() document.all.tableID.createCaption() // IE only


     </source>