JavaScript Reference/Javascript Properties/span

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

"span" Example

   <source lang="javascript">
   

<html> <body>

<colgroup> <col id="col_1"> <col id="col_2"> <col id="col_3">
Column 1 Column 2 Column 3 Column 4 Column 5 Column 6
Cell 1 Cell 2 Cell 3 Cell 4 Cell 5 Cell 6

<input type="button" value="Span" onClick="function1();"> <script language="JavaScript">

   document.getElementById("col_1").span = 2;
   document.getElementById("col_2").span = 3;
   document.getElementById("col_3").span = 1;
   function function1() {
       document.getElementById("col_2").align = "center"
       document.getElementById("col_2").style.color = "green"; 
   } 

</script>


     </source>
   
  


"span" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<col> <colgroup> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"span" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Specifies the column number in the group, for applying a single style to all columns in the group. This property does not change the rendering of the table.

Syntax:

document.getElementById("elementID").span = value document.all.elementID.span = value // IE only


     </source>