One more step towards technology

Max Character Limit For Text Area

In Fun with technology on July 2, 2010 at 9:59 am

<body style=”font-family:Arial, Helvetica, sans-serif; font-size:12px;”>
<div style=”width:600px;”><strong>Enter Your Status</strong>
<textarea onkeyup=”char_count()” style=”width:600px; height:400px;” id=”text_area”></textarea>
</div>
<div style=”clear:both;”></div>
<div><strong>Char Count :</strong> <span id=”count”></span></div>
<script language=”javascript”>
document.getElementById(“count”).innerHTML = 30;
function char_count()
{
var t=(document.getElementById(“text_area”).value).length;
if(t>30)
{
document.getElementById(“count”).innerHTML = “-” + (t-30);
document.getElementById(“count”).style.color=”red”;
}
else
{
document.getElementById(“count”).innerHTML = (30 – t);
document.getElementById(“count”).style.color=”black”;
}
}
</script>
</body>

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.