일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- date
- input
- windows
- 배열
- 정규식
- list
- 자바
- 자바스크립트
- Maven
- 이클립스
- javascript
- table
- IntelliJ
- Array
- Java
- html
- 테이블
- 인텔리제이
- Eclipse
- vscode
- Button
- json
- CSS
- CMD
- 이탈리아
- ArrayList
- string
- 문자열
- js
- Visual Studio Code
- Today
- Total
목록insertCell (2)
어제 오늘 내일
지난 번에는 테이블에 행(row)를 추가/삭제하는 방법을 알아보았습니다. 이번에는, 테이블에 열을 추가하고, 삭제하는 방법을 알아보도록 하겠습니다. 열(column) 추가하기 사과apple 오렌지orange 바나나banana function addColumn() { const table = document.getElementById('fruits'); for(let i = 0; i < table.rows.length; i++) { const newCell =table.rows[i].insertCell(-1); newCell.innerText = 'New'; } } document.getElementById('fruits'); 열을 추가할 테이블을 선택합니다. table.rows.length; 테이블의 행..
이번에는 버튼을 클릭하여 테이블에 행을 추가하고 삭제하는 방법을 알아보도록 하겠습니다. 1. 테이블에 행 추가하기 - insertRow(), insertCell() 2. 테이블에 행 삭제하기 - deleteRow() 1. 테이블에 행 추가하기 - insertRow(), insertCell() insertRow(), insertCell() 함수 테이블에 행(Row)를 추가하기 위해서는 insertRow(), insertCell() 함수를 사용합니다. insertRow() var newRow = HTMLTableElement.insertRow(index); table element에 새로운 행을 추가해 줍니다. 파라미터 index 새로 생성된 행(row)가 테이블에 들어갈 위치 index를 넣어줍니다. 파라..