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