实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function topAlign()
6
{
7
document.getElementById('tr2').vAlign="top";
8
}
9
</script>
10
</head>
11
<body>
12
13
<table width="50%" border="1">
14
<tr id="tr1">
15
<th>Firstname</th>
16
<th>Lastname</th>
17
<th>Text</th>
18
</tr>
19
<tr id="tr2">
20
<td>Peter</td>
21
<td>Griffin</td>
22
<td>Hello my name is Peter Griffin. 
23
I need a long text for this example. 
24
I need a long text for this example.</td>
25
</tr>
26
</table>
27
<br>
28
<input type="button" onclick="topAlign()" value="Top-align table row" />
29
30
</body>
31
</html>