Output array to <LI> element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Li

Description

Output array to <LI> element

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() {/*from   w  ww.j  a  v  a2 s  . co m*/
var books = [
   "F",
   "T",
   "N"
];
var html = "";
for (var i =0; i < books.length; i++) {
    html += "<li>" + books[i]+ "</li>";
}
document.getElementById("books").innerHTML = html;
    });

      </script> 
   </head> 
   <body> 
      <ol id="books"> 
      </ol>  
   </body>
</html>

Related Tutorials