HTML DOM width Property
Complete Table Object Reference
Definition and Usage
The width property sets or returns the width of a table.
Syntax
tableObject.width=percent|pixels
|
Example
The following example changes the width of a table:
<html>
<head>
<script type="text/javascript">
function changeWidth()
{
document.getElementById("table1").width="100%";
}
</script>
</head>
<body>
<table id="table1" border="1">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=changeWidth()
value="Change table width" />
</body>
</html>
|
Try-It-Yourself Demos
Change
the width of a table
Complete Table Object Reference
|