Change various elements style.left and top with script?
<p>I have this loop that produces many elements with different positions:</p>

<pre><code>if ( $row['Type'] == "house") { ?&gt;
    &lt;div class="itemW" style="margin-left: &lt;?=$row['X']?&gt;px; margin-top: &lt;?=$row['Y']?&gt;px;"&gt;
    Item
   &lt;/div&gt; &lt;? 
}       
</code></pre>

<p>I need to change all the divs left position, I'm trying this:</p>

<pre><code> var items = document.getElementsByClassName("itemW");
 items[0].style.left = land.width() / items[0].style.left * 100;
</code></pre>

<p>The problem is that <code>items[0].style.left</code> doesn't get the position of the first div. Also I don't know how to do it with all the divs.</p>
