HTML DOM width Property
Complete TableCell Object Reference
Definition and Usage
The width property sets or returns the width of
a table cell.
Note: The entire column will be affected.
Syntax
tabledataObject.width=percent|pixels
|
Example
The following example changes the width of a table cell:
<html>
<head>
<script type="text/javascript">
function changeWidth()
{
document.getElementById("td1").width="200px";
}
</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=changeWidth() value="Change width" />
</body>
</html>
|
Try-It-Yourself Demos
Change the width of a table cell
Complete TableCell Object Reference
Learn XML with <oXygen/> XML Editor - Free Trial!
|
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|