Home > Web Front-end > JS Tutorial > body text

JavaScript dynamically adds script code to cells_javascript skills

WBOY
Release: 2016-05-16 19:07:35
Original
1119 people have browsed it

How to add cells dynamically!!

Copy code The code is as follows:

Use insertRow() and The insertCell() method

is used as follows:
insertRow()
Copy code Code As follows:

var newTR=TableOBJ.insertRow(N);

Copy code The code is as follows:

N represents which row to insert!
Explanation: When N=0, insert to the top row! When N=-1, insert to the end One line, quite omitting this parameter!
insertCell()

Copy code The code is as follows:

var newTD=TrOBJ.insertCell(N);

where N indicates which column to insert into!
Note: When N=0, insert to the top One line! Insert to the last line when N=-1, this parameter is quite omitted!
The following is an example code:
Copy code The code is as follows:




Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!