<HTML>
<HEAD>
<TITLE>Limitar Caracteres</TITLE>
<script LANGUAGE=javascript>
function max(txarea)
{
total = 10;
tam = txarea.value.length;
str="";
str=str+tam;
Digitado.innerHTML = str;
Restante.innerHTML = total - str;

if (tam > total){
aux = txarea.value;
txarea.value = aux.substring(0,total);
Digitado.innerHTML = total
Restante.innerHTML = 0
}
}
</SCRIPT>
</HEAD>
<BODY>
<form onsubmit="if(document.forms[0].Area.value.length > 9){alert('Tamanho do texto supera o permitido: m�ximo 10 caracteres'); document.forms[0].Area.select(); return false}">
<textarea onkeyup="max(this)" onkeypress="max(this)" rows="4" cols="35" name="Area"></textarea>
<br>
<font id="Digitado" color="red">0</font> Caracteres digitados / Restam <font id="Restante" color="red">10</font>
<br>
<input type="submit">
</form>
</BODY>
</HTML>