align 属性可设置或返回表格单元内数据的水平排列方式。
tabledataObject.align=left|right|center
下面的例子把单元格的内容排列到了右边:
<html>
<head>
<script type="text/javascript">
function alignCell()
{
document.getElementById('td1').align="right"
}
</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="alignCell()"
value="Align cell" />
</body>
</html>