'createElement()' Example : createElement « Javascript Methods « JavaScript Reference

'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>

    
      
      








Related examples in the same category

1.'createElement()' Syntax, Parameters and Note
2.'createElement()' is applied to