对齐单元格中的内容
- <html>
- <head>
- <script type="text/javascript">
- function alignCell()
- {
- document.getElementById('td1').align="right"
- }
- </script>
- </head>
- <body>
- <table border="1">
- <tr>
- <th>-----名-----</th>
- <th>-----姓-----</th>
- </tr>
- <tr>
- <td id="td1">John</td>
- <td>Adams</td>
- </tr>
- </table>
- <form>
- <input type="button" onclick="alignCell()"
- value="对齐 'John' 单元格" />
- </form>
- </body>
- </html>