JS Dynamic Control Form table

Source: Internet
Author: User

JS Dynamic Control Form table, here to speak only, add a row, delete a row, delete a row of a column.

Directly put the code:

<! DOCTYPE html><!--here is an interesting thing, for= "Cao", and then <input/> Add ID to Cao, you click here Text, will prompt you in input--><p><label for= "Cao "> Name is what, click I can go inside the box: </label><input type=" text "id=" Cao "/></p></form><script> Window.onload = function () {/* Creates a row, executes the Chuang () function */chuang ();/* Deletes a row, or a column of one row, executes the Dete function/dete (); function Chuang () {var tab = document.getElementById ("tabl");/* takes the object to be manipulated */var tr = Tab.insertrow (2);/* Adds a row with ordinal 2 to it */var Ptext = new Array ();/* Create number of text node groups */ptext[0] = document.createTextNode ("Black Pig"); PTEXT[1] = document.createTextNode ("998342"); for (var i = 0; i < ptext.length; i++) {/* traverse */var cd = Tr.insertcell (i);/* Press The ordinal creates the column */cd.appendchild (Ptext[i]);/* Adds a text node to the corresponding column/}} function Dete () {var tab = document.getElementById ("Tabl"); Tab.deleterow (4);/* Deletes a row */tab.rows[3].deletecell (1);/* Deletes a row of a column */}}</script></body>

  

JS Dynamic Control Form 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.