[thelist] DOM ol li listing issue, Please Help!!!

S.F. Alim salim at vodatel.com
Mon Aug 15 05:34:33 CDT 2005


Hi list,
 
This is my first time posting my question, so here is my question.
I’ve learn little bit of javascript and dom concept together. Following are my code ….
 
 
<html>
 <head>
  <title>Create Element Practise Page #1</title>
  <script language="JavaScript">
    var d = document
   
   function makeList() {
   
    var target = d.getElementById('test');
    
    var ol = d.createElement('ol');
    var li = d.createElement('li');
    
    var line = new Array ("One","Two","Three","Four","Five"); 
    var i; 
    
     for( i=0; i<line.length;i++) {
      //alert(line[i]);
      ol.appendChild(li.cloneNode(true));
         }
     target.appendChild(ol);
 
   }
 
  </script>
 </head>
 <body>
 <a href="javascript:makeList()">Click to Create Link</a>
 
  <div id="test"></div>
 </body>
</html>
 
 
the result I want to get is that array to list out when I click the link.
I google a lot and found few example and I try to append them but to my sorrow I have reached my limits of thinking.
I will appreciate if someone can help me with it.
 
S.F.Alim
 
Ps: beside that my weakess point in programming is array only.


More information about the thelist mailing list