TableHeader 헤더 속성
예시
ID가 "myTh"인 <th> 요소의 headers 속성 값을 반환합니다.
var x = document.getElementById("myTh").headers;
정의 및 사용
headers 속성은 headers 속성의 값을 설정하거나 반환합니다.
headers 속성은 현재 데이터 셀에 대한 헤더 정보를 포함하는 헤더 셀 목록을 지정합니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
headers | Yes | Yes | Yes | Yes | Yes |
통사론
headers 속성을 반환합니다.
tableheaderObject.headers
headers 속성을 설정합니다.
tableheaderObject.headers = header_ids
속성 값
Value | Description |
---|---|
header_ids | Specifies a space-separated list of id's to one or more header cells the table cell is related to |
기술적 세부 사항
반환 값: | 공백으로 구분된 헤더 셀 식별자 목록을 포함하는 문자열 |
---|
더 많은 예
예시
두 번째 행의 셀 헤더 표시:
var table = document.getElementById("myTable");
var txt = "";
var i;
for (i = 0; i < table.rows[1].cells.length; i++) {
txt = txt + table.rows[1].cells[i].headers + "<br>";
}
예시
id가 "myTh"인 <th> 요소의 headers 속성 값을 변경합니다.
document.getElementById("myTh").headers = "newValue";
관련 페이지
HTML 참조: HTML <th> 헤더 속성
❮ TableHeader 객체