<html>
<head>
<script type="text/javascript">
function alignCell(){
var x=document.getElementById('myTable').rows[0].cells
x[0].align="center"
}
</script>
</head>
<body>
<table id="myTable" border="1" width="100%">
<tr>
<td>First cell</td>
<td>Second cell</td>
</tr>
<tr>
<td>Third cell</td>
<td>Fourth cell</td>
</tr>
</table>
<form>
<input type="button" onclick="alignCell()" value="Align cell content">
</form>
</body>
</html>
|