JS Add Table

Source: Internet
Author: User

Caption: Holds pointers to <caption> elements (if any)

Tbodies: is a <tbody> element of the htmlcollection.

TFoot: Holds a pointer to the <tfoot> element

THead: Holds a pointer to the <thead> element

Rows: Is the htmlcollection of all rows in a table

Createthead (): Create a <thead> element, place it in a table, return a reference

Createtfoot (): Create a <tfoot> element, place it in a table, return a reference

Createcaption (); Create a <caption> element, place it in a table, return a reference

Deletethead: Delete <thead> element

Deletetfoot: Delete <tfoot> element

Delectcaption: Delete <caption> element

DeleteRow (POS): Delete a row at a specified location

InsertRow (POS): Inserts a row into the rows collection at the specified location

The birthday and method for the <tbody> element are as follows

Rows: Save the htmlcollection of the row in the <tbody> element.

DeleteRow (POS): Delete a row at a specified location

Insertrohew (POS): Inserts a row into the rows collection at the specified location, returning a reference to the newly inserted row.

The properties and methods added for the <tr> element are as follows

Cells: Holds the htmlcollection of the cells in the <tr> element.

Deletecell (POS): Deletes the cell at the specified location.

InsertCell (POS): Inserts a cell into the cells collection at the specified position, returning a reference to the newly inserted cell

Example

var table = document.createelement ("table");

Table.border = 1;

Table.width = "100%";

var tbody = document.createelement ("tbody");

Table.appendchild (TBODY);

Create first row

Tbody.insertrow (0);

Tbody.rows[0].insertcell (0);

Tbody.rows[0].cells[0].appendchild (document.createTextNode ("Cell"));

Tbody.rows[0].insertcell (1);

Tbody.rows[0].cells[1].appendchild (document.createTextNode ("cell2,1"));

JS Add Table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.