title: How to extract each character in a textarea using Javascript (not jQuery)
body: <p>I have a straight forward classic ASP page that uses a  where the user can enter any standard keyboard key plus the Enter key (and even special ALT nnn values if they so desire)</p>
  
  <p>The current HTML code is as follows:</p>
  
  <pre><code>Enter your message - Characters left &amp;nbsp;
  &lt;input type="text" name="chl" value="&lt;%=Cclen%&gt;" size=3 diabled readonly&gt;
  &lt;br /&gt;
  &lt;textarea id="SMSmsg" name="SMSmessage" MAXLENGTH="600" rows=5 cols=35 onKeyUp="textCounter(this)"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>The JavaScript function <strong>testcounter</strong> currently uses <strong>indexOf("\n")</strong> which goes through the entire <strong>textarea</strong> every time a key is released.  I also need to determine if other special chars have been entered as they coult for 2 chars when sending an SMS</p>
  
  <p>In summary, can anybody suggest some JS code that will let me determine each char that the user has entered (preferably turn it into it's ascii value) so I can then accurately work out the char count and display it to the user if it exceeds the <strong>160 limit</strong> but I can also handle 306 chars and up to 457 chars when sending SMS texts</p>
  
  <p>Perhaps the <strong>MATCH</strong> function could be the go as it would only have to check the entire string once but any other <strong>suggestions</strong> much appreciated</p>
  
  <p>Thanks in advance and apologies if anybody needs the JS code</p>