Examples of innerHTML usage in Javascript
This article describes how to use innerHTML in Javascript. examples show how to use innerHTML to obtain the content of corresponding elements. For more information, see
This example describes how to use innerHTML in Javascript. Share it with you for your reference.
The specific implementation method is as follows:
The Code is 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 ()"> Use of innerHTML </button>
</Body>
</Html>
I hope this article will help you design javascript programs.