JavaScript Reference/Javascript Properties/rowSpan

Материал из Web эксперт
Версия от 18:30, 25 мая 2010; (обсуждение)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"rowSpan" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    document.getElementById("myTableHeader").rowSpan = 2;
}
function function2() {
    location.reload();
}
</script>
<table width="542" border="10" bordercolor="red" cellpadding="20">
    <tr>
        <th id="myTableHeader">Cell 1</th>
        <th>Cell 2</th>
        <th id="th5">Cell 3</th>
    </tr>
    <tr>
        <th>Cell 4</th>
        <th id="th2">Cell 5</th>
        <th>Cell 6</th>
    </tr>
    <tr>
        <th>Cell 7</th>
        <th>Cell 8</th>
        <th>Cell 9</th>
    </tr>
    <tr>
        <th >Cell 10</th>
        <th >Cell 11</th>
        <th >Cell 12</th>
    </tr>
</table>
<input type="button" value="Span(2) Cell 1" onClick="function1();">
<input type="button" value="Restore" onClick="function2();">
</body>
</html>



"rowSpan" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<td>                            <th>                          |
+----------------+--------------------------------------------------------------+



"rowSpan" Syntax and Note

Note:
Read and write property. 
Specifies the number of table rows that the cell should span.
    
Syntax:
    
document.getElementById("elementID").rowSpan = value
document.all.elementID.rowSpan = value // IE only