This article describes the usage of innerHTML in Javascript. Share it for your reference.
The specific implementation method is as follows:
Copy the code as follows: <html>
<head>
<script type="text/javascript">
function t(){
var cont = document.getElementById('container');
var htmlcode = "<p>Hahaha</p>";
cont.innerHTML = htmlcode;
}
</script>
</head>
<body>
<div id="container">
<ul>
<li>Spring</li>
<li>Summer</li>
<li>Autumn</li>
<li>Winter</li>
</ul>
</div>
<div id="copyul">
</div>
<hr />
<button onclick="t()">Usage of innerHTML</button>
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.