<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
margin: 10px;
}
</style>
</head>
<body>
<p>点击该按钮可获取表格标题的位置。</p>
<button onclick="myFunction()">试一试</button>
<table>
<caption id="myCap" style="caption-side:bottom;">客户资料</caption>
<tr>
<th>公司</th>
<th>联系人</th>
<th>国家</th>
</tr>
<tr>
<td>Alibaba</td>
<td>Jack Ma</td>
<td>China</td>
</tr>
<tr>
<td>Microsoft</td>
<td>Bill Gates</td>
<td>American</td>
</tr>
<tr>
<td>Porsche</td>
<td>Oliver Blume</td>
<td>Germany</td>
</tr>
</table>
<script>
function myFunction() {
alert(document.getElementById("myCap").style.captionSide);
}
</script>
</body>
</html>