Mega Code Archive

 
Categories / JavaScript Reference / Javascript Methods
 

CreateElement() Example

<html> <body> <script language="javascript"> function function1(){    var myElement = document.createElement('<hr>');    myBody.appendChild(myElement);        myElement = document.createElement('<Br>');    myBody.appendChild(myElement);    myElement = document.createElement('<Hr>');    myBody.appendChild(myElement); } </script> <body id="myBody"> <button onClick="function1();">Put horizontal rule</button> </body> </html>