Restricting Characters in Textarea / showing count down On IE
<p>I am fairly new to javascript.</p>

<p>I am trying to limit characters to 200 in textarea, showing a count down. I have achieved this by using the below code. I have 4 textareas. The data is getting written to SQL Database where the datatype is Varchar(5000)</p>

<p>I am able submit the form without any issue if one textarea contains 200 characters, and other 3 have 50 characters each.  </p>

<p>However, I am not able submit my form if each textarea contains 200 characters. </p>

<p>I am getting "invalid Syntax" error if each one of them contains 200 characters (800 characters altogether). The invalid Syntax error is just pointing to line 212, that's where my submit function is, it doesn't tell me anything since I am able to submit without any issue if one has 200 characters and others have a lot less.  I am using IE 6.</p>

<pre><code>&lt;td align = "left"&gt;&lt;span class = "cssFormLabel"&gt;&lt;b&gt;text 1 &lt;/b&gt; &lt;font size="1"&gt; &lt;span&gt;&lt;/td&gt;
 &lt;script language="javascript" type="text/javascript"&gt;
function counterUpdate(opt_countedTextBox, opt_countBody, opt_maxSize) {
        var countedTextBox = opt_countedTextBox ? opt_countedTextBox : "text1";
        var countBody = opt_countBody ? opt_countBody : "countBody";
        var maxSize = opt_maxSize ? opt_maxSize : 5000;
        var field = document.getElementById(countedTextBox);
        if (field &amp;&amp; field.value.length &gt;= maxSize) {
                field.value = field.value.substring(0, maxSize);
        }
        var txtField = document.getElementById(countBody);
                if (txtField) {
                txtField.innerHTML = field.value.length;
        }
}
&lt;/script&gt;
&lt;td&gt;
&lt;center&gt;
&lt;br&gt;
 &lt;font size="1" face="arial, helvetica, sans-serif"&gt; &lt;b&gt;( Maximum 200 characters )&lt;br&gt;&lt;/b&gt;&lt;/center&gt;
        &lt;textarea id="text1" name="text1" cols=30 rows=13 onkeyup="counterUpdate(' text1', 'countBody','200');"&gt;&lt;/textarea&gt;
  &lt;center&gt; You typed &lt;B&gt;&lt;span id="countBody"&gt;0&lt;/span&gt; &lt;/b&gt; characters &lt;/center&gt;
   &lt;/td&gt;



 &lt;td align = "left"&gt;&lt;span class = "cssFormLabel"&gt;&lt;b&gt;text3&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;

&lt;script language="javascript" type="text/javascript"&gt;
function counterUpdate3(opt_countedTextBox3, opt_countBody3, opt_maxSize3) {
        var countedTextBox3 = opt_countedTextBox3 ? opt_countedTextBox3 : "text3";
        var countBody3 = opt_countBody3? opt_countBody3: "countBody3";
        var maxSize3 = opt_maxSize3 ? opt_maxSize3 : 5000;
        var field3 = document.getElementById(countedTextBox3);
        if (field3 &amp;&amp; field3.value.length &gt;= maxSize3) {
                field3.value = field3.value.substring(0, maxSize3);
        }
        var txtField3 = document.getElementById(countBody3);
                if (txtField3) {
                txtField3.innerHTML = field3.value.length;
        }
}
&lt;/script&gt;

&lt;td&gt;
&lt;center&gt;&lt;font size="1" face="arial, helvetica, sans-serif"&gt; &lt;b&gt;( Maximum 200 characters )&lt;br&gt;&lt;/b&gt;&lt;/center&gt;
  &lt;textarea id="text3" name="text3"  cols=30 rows=13 onkeyup="counterUpdate3('text3', 'countBody3','200');"&gt;&lt;/textarea&gt;
    &lt;center&gt;&lt;b&gt;  You typed &lt;B&gt;&lt;span id="countBody3"&gt;0&lt;/span&gt;&lt;/b&gt; characters &lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;**
</code></pre>
