Rounding up values and putting it in another element
<p>my code below does what its suppose to do with one little problem. i have sat up for hours trying to fix it. could anyone help me out please. </p>

<pre><code>var price = new Array(12.121212, 45.334, 2.34, 0);

for (var i=0;i&lt;price.length;i++){
        roundPrice[i] = Math.round(price[i]*100)/100;
    }

    var s = document.getElementsByTagName('input');
        for (var i=0;i&lt;s.length;i++) {
            if (s[i].className == 'price') {//changed this to get class instead
                    s[i].value = roundPrice[0];
            }

        }
</code></pre>

<p>the line that is giving me a headache is </p>

<pre><code>s[i].value = roundPrice[1];
</code></pre>

<p>if i state the actual index of the array, it puts that single value into all the input element specified.</p>

<p>on the other hand, if i use this line of code (below), i get 'undefined ' as a result in all the element specified.</p>

<pre><code>s[i].value = roundPrice[i];
</code></pre>

<p>Thank you</p>
