javascript sometimes fails to enable/disable textarea controls
<p>oi. i generate html and javascript for use within a c# webbrowser, and i'm debugging it with firebug via firefox.</p>

<pre><code>function able(id,ckd) {
  if(document.getElementById) {
    var el = document.getElementById("answer"+id);
    el.disabled = ckd;
    el = document.getElementById("comment"+id);
    el.disabled = ckd;
  }
}
</code></pre>

<p>for use against</p>

<pre><code>&lt;html&gt;&lt;head&gt;&lt;style type="text/css"&gt;&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;form&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;input name="asked" id="asked1" type="checkbox" checked onchange="able('1',!this.checked);" /&gt;&amp;nbsp;Active&lt;/td&gt;
      &lt;td&gt;&lt;textarea name="answer" id="answer1"&gt;Some big, fat answer.&lt;/textarea&gt;&lt;/td&gt;
      &lt;td&gt;&lt;textarea name="comment" id="comment1"&gt;Some snarky comment.&lt;/textarea&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;input name="asked" id="asked2" type="checkbox" onchange="answer2.disabled=!this.checked;comment2.disabled=!this.checked;" /&gt;&amp;nbsp;Active&lt;/td&gt;
      &lt;td&gt;&lt;textarea name="answer" id="answer2" disabled&gt;&lt;/textarea&gt;&lt;/td&gt;
      &lt;td&gt;&lt;textarea name="comment" id="comment2" disabled&gt;&lt;/textarea&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;input name="save" type="button" onclick="window.external.UpdateCandidateQuestions();" value="save" /&gt;
  &lt;input name="reset" type="reset" value="reset" /&gt;
&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre>

<p>the real generated html is LONG but well-formed, and i was careful to avoid cached pages while testing. the second method (asked2.onchange uses inline javascript) works less well than the first method (asked1.onchange calls javascript function defined in the head). the id counter (ie, asked"1", asked"2", asked"3", et al) and the answer and comment innertext values are either from a database or entered via webbrowser. there is a consistent fail point, and firebug walks through it as if it works, but it fails. if i remove table rows before and/or after the full data fail point, the fail point moves. once it fails, the remainder of the page fails as well.</p>

<p>please advise on where else i might debug this pima.</p>
