Where The Streets Have No Name

테이블 객체에 대한 정리 본문

Developement/Web

테이블 객체에 대한 정리

highheat 2006. 4. 9. 02:37

테이블객체 모음(dhtml)
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/table/table.asp

테이블 객체의 속성들     자세한 내용은 상위 페이지를 참조하여 사용할 수 잇습니다.
====================
align
background
bgColor
border
borderColor
borderColorDark
borderColorLight
caption
cellPadding
cellSpacing
cols
createCaption
createTFoot
createTHead
dataPageSize
deleteCaption
deleteRow  //행삭제
deleteTFoot
deleteTHead
frame
height
insertRow   //입력할 행의 객체를 가지고 온다.
nextPage
onreadystatechange
previousPage
readyState
refresh
rows
rules
tBodies
tFoot
tHead
width

[간단 사용예]
==========================================
tbl: 테이블 객체 <table...    id="tbl">
tbl.rows[i] : 테이블의 행 객체
tbl.rows[i].cells[j] : i열 j행 객체

[각 셀에 있는 객체에 접근 하는 법]
=============================================
tbl.rows[i].cells[0].childNodes.item(0).value  : i행 0번째 컬럼의 객체의 값

tbl.rows[i].cells[0].innerHTML                      : i행 0번째 컬럼의 html내용을 가지고온다<td>내용</td>

 

[각 셀에서 테이블 객체 등에 접근 하는 법]
=====================================================
<td><inut type="radio" onclick="check(parentNode.parentNode.rowIndex)"></td>
:셀에서 상위 노드로 올라가 선택되어진 로우의 값을 가지고 온다.

 

[행을 추가 하는 방법]
============================================================
var gRows  = tbl.insertRow();


//gRows.onmousedown = function(){selectRow(this)}
//gRows.onmouseover = function(){tblMouseOver(this)}
//gRows.onmouseout = function(){tblMouseOut(this)}


//셀 정의.
var oCell = new Array();
oCell[0]    = gRows.insertCell();  
oCell[1]    = gRows.insertCell();  

//각 셀에 html값을 입력합니다.
oCell[0].innerHTML = "";

oCell[1].innerHTML ="";