Forums

ASP

This topic is locked

ASP Text Area get length

Posted 06 Aug 2005 06:41:18
1
has voted
06 Aug 2005 06:41:18 Lam Cindy posted:
Dear all,

Please help~ How can I get the length of the entered character within a text area?

Thanks All

Replies

Replied 06 Aug 2005 23:04:25
06 Aug 2005 23:04:25 Raafat Abdul replied:
<pre id=code><font face=courier size=2 id=code>

&lt;%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;script&gt;
function getLength()
{
var str=document.form1.TXT.value;
var strLength=str.length;
alert(strLength);
}
&lt;/script&gt;

&lt;body&gt;
&lt;form name="form1" method="post" action=""&gt;
&lt;p&gt;
&lt;textarea name="TXT" id="TXT"&gt;&lt;/textarea&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;input type="button" name="b1" value="Count String Length" onClick="getLength()"&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

</font id=code></pre id=code>

Reply to this topic