HTML DOM colSpan Property
Complete TableCell Object Reference
Definition and Usage
The colSpan property sets or returns the number of columns a table cell
should span.
Syntax
tabledataObject.colSpan=number_of_columns
|
Example
The following example changes the number of columns a table cell
should span:
<html>
<head>
<script type="text/javascript">
function changeColSpan()
{
document.getElementById("td1").colSpan="2";
}
</script>
</head>
<body>
<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=changeColSpan()
value="Change colspan" />
</body>
</html>
|
Try-It-Yourself Demos
Change the number of columns a table cell should span
Complete TableCell Object Reference
|