Changing contents of an element via innerHTML - Javascript DOM

Javascript examples for DOM:Element innerHTML

Description

Changing contents of an element via innerHTML

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {/* w  w  w .  jav a 2s  . c o  m*/
var array = ['This is where', 'the text will go'];
document.getElementById('current_feed').innerHTML = array[0];
    });

      </script> 
   </head> 
   <body> 
      <label id="current_feed"> "The commentary will appear here." </label>  
   </body>
</html>

Related Tutorials