JavaScript

[HTML_Objects] JS - <caption> 객체 - 테이블제목 (= 표제목 = caption태그 = 캡션태그) (HTML5 align 속성 지원 X)

목차

  1. <caption> 객체 정의 - 테이블 제목
  2. <caption> 객체 구문
  3. <caption> 객체 예제 - 접근
  4. <caption> 객체 예제 - 생성
  5. <caption> 객체 속성

 

<caption> 객체 정의 - 테이블 제목

 

HTML <caption> 태그(요소) 의미.

 

 

<caption> 객체 구문

 

[접근]

var x = document.getElementById("요소ID");

 

[생성]

var x = document.createElement("CAPTION");

 

※ Table 객체의 createCaption() 메서드 이용해 Caption 요소 생성 가능.

 

<caption> 객체 예제 - 접근

 

<style>

table, th, td {border: 1px solid black; border-collapse:collapse;}

</style>


<table>

  <caption id="hz">Homzzang.com</caption>

  <tr>

     <th>코딩언어</th>

     <th>역할</th>

  </tr>

  <tr>

     <td>HTML</td>

     <td>기본틀</td>

  </tr>

  <tr>

     <td>CSS</td>

     <td>디자인</td>

  </tr>

</table>


<button onclick="homzzang()">클릭</button>


<script>

function homzzang() {

  var x = document.getElementById("hz");

  x.style.color = "red";

}

</script> 

 

결과보기

 

<caption> 객체 예제 - 생성

 

<style>

table, th, td {

  border: 1px solid black; 

  border-collapse:collapse;

}

</style>


<table id="hz">

  <tr>

     <th>코딩언어</th>

     <th>역할</th>

  </tr>

  <tr>

     <td>HTML</td>

     <td>기본틀</td>

  </tr>

  <tr>

     <td>CSS</td>

     <td>디자인</td>

  </tr>

</table>


<button onclick="homzzang()">클릭</button>


<script>

function homzzang() {

  var x = document.createElement("CAPTION");

  var t = document.createTextNode("Homzzang.com");

  x.appendChild(t);


  var table = document.getElementById("hz")

  table.insertBefore(x, table.childNodes[0]);

}

</script> 

 

결과보기 

 

<caption> 객체 속성

 

align

HTML5 지원 X. 대신 style.textAlign 또는 style.captionSide 속성 사용.
캡션의 정렬 설정/반환.

 

※ <caption> 객체는 표준 속성/메서드/이벤트 지원.


분류 제목
Window_Location JS - replace() 메서드(※ Location용) ★★ - 새 웹문서 로드. (= 주소이동 = rep…
Window_Navigator JS - appCodeName 속성 - 브라우저코드명 (= 브라우저코드이름) 반환
Window_Navigator JS - appName 속성 - 브라우저명 반환 (= appName속성 = 앱네임속성) ※ 브라우저이름 확인…
Window_Navigator JS - navigator.appVersion 속성 - 브라우저버전 반환 (= navigator.appVer…
Window_Navigator JS - navigator.cookieEnabled 속성 - 브라우저 쿠키 사용 여부 결정 (= 네비게이터쿠…
Window_Navigator JS - geolocation -
Window_Navigator JS - navigator.language 속성 ★ - 브라우저 언어 반환 (= navigator.langu…
Window_Navigator JS - onLine -
Window_Navigator JS - navigator.platform 속성 - 브라우저가 컴파일 된 플랫폼 반환 (= 네비게이터플랫폼속…
Window_Navigator JS - product 속성 - 브라우저 엔진이름 (IE11 이상)
Window_Navigator JS - navigator.userAgent 속성 - 사용자 브라우저 정보 반환 (= navigator.us…
Window_Navigator JS - javaEnabled() 메서드 -
Window_Navigator JS - taintEnabled() 메서드 - JS1.2 버전에서 폐기완료. 브라우저에 데이터오염 있는지 확…
Window_Screen JS - availHeight 속성 ★ - 화면높이 (※ 작업표시줄 제외)
Window_Screen JS - availWidth 속성 ★ - 화면너비 (※ 작업표시줄 제외)
55/89
목록
 홈  PC버전 로그인 일본어
그누앞단언어
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 2
웹유틸
회원센터
홈짱닷컴 PC버전 로그인