Modifying Elements after Page loads : innerHTML « Node Operation « JavaScript DHTML






Modifying Elements after Page loads

   

<html>
<head>
<title>Modifying Elements after Page loads</title>
<script type="text/javascript">
function changeDiv() {
   var elem1 = document.getElementById("elem1");
   elem1.innerHTML = "<h1>Hello World</h1>";

}
</script>
<body onload="changeDiv();">
<div id="elem1">
    <p>Paragraph text.</p>
</div>

</body>
</html>

   
    
    
  








Related examples in the same category

1.'innerHTML' Example
2.Get the paragraph tag and set its innerHTML value
3.Switch html with assigning the innerHTML