Home > Article > Web Front-end > What is the usage of innerhtml?
The innerHTML attribute sets or returns the HTML between the start and end tags of the table row.
Syntax
tablerowObject.innerHTML=HTML
Example
The following example returns the inner HTML of a table row:
<html> <head> <script type="text/javascript"> function getInnerHTML() { alert(document.getElementById("tr1").innerHTML); } </script> </head> <body> <table border="1"> <tr id="tr1"> <th>Firstname</th> <th>Lastname</th> </tr> <tr id="tr2"> <td>Peter</td> <td>Griffin</td> </tr> </table> <br /> <input type="button" onclick="getInnerHTML()" value="Alert innerHTML of table row" /> </body> </html>
Related recommendations: "HTML Tutorial" "javascript Tutorial"
This article is an introduction to the usage of innerhtml. I hope it will be helpful to friends in need!
The above is the detailed content of What is the usage of innerhtml?. For more information, please follow other related articles on the PHP Chinese website!