JavaScript dynamic parameters
<p>I have following code (html,js,jquery) snippet (<a href="http://jsfiddle.net/MUScJ/2/" rel="nofollow">http://jsfiddle.net/MUScJ/2/</a>):</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function someFunc(){
    html = '';
    z = 1;
    for(i=0; i&lt;5; i++){
        html += '&lt;input type="button" value="Button_'+z+'"' +
                'onclick="otherFunc(z);"&gt;';
         z++;
    }

    $("#container").html(html);

   return true;
}

function otherFunc(z){
    alert('z:' + z);

     return true;   
}

&lt;/script&gt;   

&lt;div id="container"&gt;&lt;/div&gt;
&lt;input type="button" value="Go" onclick="someFunc();" /&gt;
</code></pre>

<p>This script outputs five buttons with onclick event. JS function <code>otherFunc</code> always returns z variable equal to 6. Is it possible to overcome this ? I want every button have its specific z value - 1,2,3.. and etc.</p>

<p>Any ideas ? </p>
