function Count(text,long) {

var maxlength = new Number(long); // Change number to your max length.

if (text.value.length > maxlength){

text.value = text.value.substring(0,maxlength);

alert(” Only ” + long + ” chars”);

}

}