Official Google Webmaster Central Blog

Friday, November 30, 2007

Decrease the Character in your TextArea

function Count ( text, maxlength ,divdisplay )
{
if ( text.value.length > maxlength )
{
alert( maxlength + ' characters limit. \r Excessive data will be truncated.');
text.value = text.value.substring(0, maxlength);
text.focus();
}document.getElementById(divdisplay).innerHTML = text.value.length;
}

textarea id="txtaboutcorp" rows="5" cols="50" onkeypress="Count(this,10

,'divcounteraboutcorp')" onkeydown="Count(this,10,'divcounteraboutcorp')" onfocusout="Count(this,10,'divcounteraboutcorp')" style="border-style:solid;border-color:Black; border-width:thin;">

textarea

No comments: