Latest web development tutorials

HTML DOM 표 캡션 속성

테이블 객체 참조 표 개체

정의 및 사용

캡션 속성은 테이블 캡션 요소를 반환합니다.

자막 엘리먼트는 테이블의 헤더를 정의한다.

참고 : <캡션> 요소는 테이블 헤더를 정의합니다.<캡션> 태그 바로이어야합니다 <표> 태그 후, 각 테이블은 캡션을 지정할 수 있습니다. 일반적으로, 자막은 테이블 위치의 중심 위에 위치된다.

문법

tableObject.caption


브라우저 지원

Internet ExplorerFirefoxOperaGoogle ChromeSafari

모든 주요 브라우저는 캡션 속성을 지원


다음의 예는 텍스트의 형태로 <캡션> 요소를 반환합니다 :

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    alert(document.getElementById("myTable").tBodies.length);
}
</script>
</head>
<body>

<table id="myTable" border="1">
<tbody>
    <tr>
        <td>cell 1</td>
        <td>cell 2</td>
    </tr>
</tbody>
<tbody>
<tr>
        <td>cell 3</td>
        <td>cell 4</td>
</tr>
</tbody>
</table>
<br>
<button type="button" onclick="displayResult()">显示表中 tbody 元素的数目</button>

</body>
</html>

»시도


테이블 객체 참조 표 개체