案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function createCaption()
5
  {
6
  var x=document.getElementById('myTable').createCaption()
7
  x.innerHTML="我的表格标题"
8
  }
9
</script>
10
</head>
11
<body>
12
13
<table id="myTable" border="1">
14
<tr>
15
<td>Row1 cell1</td>
16
<td>Row1 cell2</td>
17
</tr>
18
<tr>
19
<td>Row2 cell1</td>
20
<td>Row2 cell2</td>
21
</tr>
22
</table>
23
<br />
24
<input type="button" onclick="createCaption()" value="创建标题">
25
26
</body>
27
</html>
28