title: Javascript character count
body: <p>Example here: <a href="http://jsfiddle.net/67XDq/1/" rel="noreferrer">http://jsfiddle.net/67XDq/1/</a></p>
  
  <p>I have the following HTML:</p>
  
  <pre><code>&lt;tr id="rq17"&gt;
      &lt;td class='qnum'&gt;17.&lt;/td&gt;
      &lt;td class='qtext'&gt;Questions? &lt;i&gt;Maximum of 500 characters - &lt;input style="color:red;font-size:12pt;font-style:italic;" readonly type="text" name="q17length" size="3" maxlength="3" value="500"&gt; characters left&lt;/i&gt;&lt;br/&gt;
                &lt;textarea 
                   onKeyDown="textCounter(document.frmSurvey.q17,document.frmSurvey.q17length,500);"
                   onKeyUp="textCounter(document.frmSurvey.q17,document.frmSurvey.q17length,500)" 
                   class="scanwid" name="q17" id="q17" rows="5" cols=""&gt;
                &lt;/textarea&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>And the following Javascript:</p>
  
  <pre><code>function textCounter(field,cntfield,maxlimit) {
      if (field.value.length &gt; maxlimit) // if too long...trim it!
      field.value = field.value.substring(0, maxlimit);
      // otherwise, update 'characters left' counter
      else
      cntfield.value = maxlimit - field.value.length;
      }
  </code></pre>
  
  <p>For some reason, which I am completely missing, this doesn't seem to be working as intended.</p>
  
  <p>It should limited the number of characters in the <code>textarea</code> and also countdown the number within the <code>label</code> but it is doing neither.</p>