엘레멘트로부터 지정된 줄(tr)과 rows 컬레션으로 부터 테이블의 줄을 제거한다.
![]() | Script | object.deleteRow([iRowIndex]) |
반환값은 없다.
tFoot, tBody, 혹은 tHead로부터 줄을 제거하면, 동시에 table의 rows 컬렉션으로부터도 줄이 제거된다. 또한 table의 줄이 제거되면 tBody의 rows 컬렉션으로부터도 제거된다.
tFoot, tBody, 혹은 tHead로부터 줄이 제거하려면 iRowIndex는 tr의 sectionRowIndex를 포함하여야 한다. table로 부터 줄을 제거하려면, iRowIndex는 tr의 rowIndex를 포함하여야 한다.
개체 | script | IE |
---|---|---|
table | table.deleteRow([iRowIndex]) | IE4.0(win16,win32,ce,unix,mac) |
tBody | tBody.deleteRow([iRowIndex]) | IE4.0(win16,win32,ce,unix,mac) |
tToot | tToot.deleteRow([iRowIndex]) | IE4.0(win16,win32,ce,unix,mac) |
tHead | tHead.deleteRow([iRowIndex]) | IE4.0(win16,win32,ce,unix,mac) |
이 메서드는 (영어)DOM Level 1(Document Object Model Level 1)에서 정의되었다.
![]() | deleteRow 메서드⇒ | ![]() | ![]() ![]() ![]() |
예제 칸1-1 | 예제 칸1-2 |
예제 칸2-1 | 예제 칸2-2 |
예제 칸3-1 | 예제 칸3-2 |
<TABLE id=tableObj border=1 width=600> <TR id=row1> <TD id=cell11>예제 칸1-1</TD> <TD id=cell12>예제 칸1-2</TD> </TR> <TR id=row2> <TD id=cell21>예제 칸2-1</TD> <TD id=cell22>예제 칸2-2</TD> </TR> <TR id=row3> <TD id=cell31>예제 칸3-1</TD> <TD id=cell32>예제 칸3-2</TD> </TR> </TABLE> <SCRIPT> function makeRow(){ newTr=tableObj.insertRow(document.createElement('<TR>')); newTd=newTr.insertCell(document.createElement('<TD>')); newTd.innerText='생성, 삽입된 줄-칸1'; newTd=newTr.insertCell(document.createElement('<TD>')); newTd.innerText='생성, 삽입된 줄-칸2'; } function delRow(){ tableObj.deleteRow(0); } </SCRIPT> <BUTTON onclick="delRow();">테이블 줄 제거 클릭</BUTTON> <BUTTON onclick="makeRow();">테이블 줄 생성 클릭</BUTTON>
![]() | deleteRow 메서드 | ⇒ | ![]() ![]() |
최종 수정: 04/06/2025 15:31:27 | ![]() All right reserved | 비정상적인 방식으로 프레임없이 페이지에 접속하면 자주 오류가 발생됩니다. 오류가 나면 정상적 접속으로 시도해 보세요. | http://koxo.com/lang/js/method/deleteRow.html |