案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function topAlign()
5
  {
6
  document.getElementById('tr2').vAlign="top";
7
  }
8
</script>
9
</head>
10
<body>
11
12
<table width="50%" border="1">
13
<tr id="tr1">
14
<th></th>
15
<th></th>
16
<th>文本</th>
17
</tr>
18
<tr id="tr2">
19
<td>John</td>
20
<td>Adams</td>
21
<td>你们好。我是名字是 John Adams。
22
在本例中,我需要一段长的文本。
23
在本例中,我需要一段长的文本。
24
在本例中,我需要一段长的文本。</td>
25
</tr>
26
</table>
27
<br />
28
<input type="button" onclick="topAlign()" value="上对齐表格行" />
29
30
</body>
31
</html>
32