<br />Related articles: innerHTML HTML DOM insertRow() Method Definition and Usage Definition and Usage The insertRow() method is used to insert a new row at a specified position in a table. The insertRow() method can be used to insert a new row at a specified position in the table. Syntax tableObject.insertRow(index) //Index, add a new row -------------------------------------------------------------------------------- Example <html> <head> <script type="text/javascript"> function insRow() { document.getElementById('myTable').insertRow(0) //Find the control in the document } </script> </head> <body> <table id="myTable" border="1"> <tr> <td>Row1 cell1</td> <td>Row1 cell2</td> </tr> <tr> <td>Row2 cell1</td> <td>Row2 cell2</td> </tr> </table> <form>//Place controls in the form <input type="button" onclick="insRow()" value="Insert new row before the first row">//value is the content to be displayed on the control </form> </body> </html> In the js method, you can directly use the id.innerHtml of the paired tags to assign the tag content without declaring variables in the js method. innerHTML is an attribute of the html tag. Most of the tags that appear in pairs have this attribute. //The tag attribute is the characters between the start tag and the end tag, not including the tag itself. For example <p id="pp">aaaaaaaaaaa<span id="ss">bbbbbbbb</span> </p> Here the p tag and span tag are nested together, so the content of pp.innerHTML is aaaaaaaaaaa<span id="ss">bbbbbbbb</span> The content of ss.innerHTML is bbbbbbbb ========================= A similar property is outerHTML Then the content of pp.outerHTML is <p id="pp">aaaaaaaaaaa<span id="ss">bbbbbbbb</span> </p> The content of ss.outerHTML is <span id="ss">bbbbbbbb</span> |
<<: How to safely shut down MySQL
>>: Multi-service image packaging operation of Dockerfile under supervisor
The enctype attribute of the FORM element specifie...
I recently made a file system and found that ther...
Table of contents Enter the topic mysql add, dele...
Copy code The code is as follows: <!DOCTYPE ht...
This article records the installation and configu...
Preface I have been working on some front-end pro...
Example source code: https://codepen.io/shadeed/p...
1. Prepare the Java environment, jdk1.8 Check whe...
1. After creating the web project, you now need t...
Table of contents Filters 01.What is 02. How to d...
Install MySQL and keep a note. I don’t know if it...
Scenario: The interaction methods between parent ...
MySQL is a relational database management system ...
Table of contents MySQL slave library Seconds_Beh...
Environment configuration 1: Install MySQL and ad...