How to get box index number using only javascript
<p>i want to get box index number using Javascript. like i have four box so i want each box text have this appropriate number.</p>

<pre><code>&lt;head&gt;

  &lt;script type="text/javascript"&gt;
  function () {
   var Main= document.getElementById('container').getElementsByTagName('div');

for(i=0; i&lt;Main.length;i++){



}

  }
  &lt;/script&gt;
  &lt;style&gt;
  .box {
    float:left;
    margin-left:20px;
    position:relative
  }
  .width {
    position:absolute;
    left:0;
    top:0;
    color:#FFF;
    font-size:20px;
  }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;div id="container"&gt;
    &lt;div class="box"&gt;

      &lt;img src="img/sample1.jpg" height="200" width="300" /&gt;
    &lt;/div&gt;
    &lt;div class="box"&gt;

      &lt;img src="img/sample2.jpg" height="200" width="350" /&gt;
    &lt;/div&gt;
    &lt;div class="box"&gt;

      &lt;img src="img/sample3.jpg" height="200" width="150" /&gt;
    &lt;/div&gt;
    &lt;div class="box"&gt;

      &lt;img src="img/sample4.jpg" height="200" width="100" /&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/body&gt;
</code></pre>
