Get readonly to all textfield with the same ID
<p>Im trying to Enable/Disable read-only property of textboxes in a colum with the same ID by clicking only one button but my code doesnt seem to work. Im still not familiar on how PHP works</p>

<p>code in PHP:</p>

<pre><code>&lt;input type='text' name='nTotal[$i]' value='$row-&gt;Total' size='5'  readonly='true' id='ntotal[$i]'&gt;
</code></pre>

<p>code in javascript:</p>

<pre><code>var a = document.getElementById(ntotal); //ntotal[$i] is the ID name of textbox in PHP
for (var i=0;i&lt;a.length;i++){            

 if (a[i].readonly == 'false' ) {
        a[i].readonly = 'true';
         }

 else if(a[i].readonly == 'true'){ 
        a[i].readonly = 'false';
          }
    }
}
</code></pre>

<p>Can anyone give me a hint on why it doesnt work? Ive tried using name instead of ID but same outcome.</p>
