Pessoal estou usando um editor de texto JS e quero delimitar a quantidade de caracteres que o usuário irá digitar. Já consigo contar os caracteres, mas não deu pra bloquear quando chegar aos 4000 caracteres. Se alguém puder me ajudar, agradeço. Segu aí o codigo: <textarea name="varc_descricao" id="varc_descricao" rows="25"></textarea>
<script type="text/javascript" src="../../FCKeditor/fckeditor.js"></script>
<script>
var sBasePath = '../../fckeditor/';
var oFCKeditor = new FCKeditor('varc_descricao', '400', '200', 'AIEC_PUBLICO' );
oFCKeditor.BasePath = sBasePath;
oFCKeditor.ReplaceTextarea();
setTimeout("contador()", 1000);
</script>
function contador()
{
var oEditor = FCKeditorAPI.GetInstance('varc_descricao');
var oDOM = oEditor.EditorDocument;
var texto;
texto = oDOM.body.innerText;
document.getElementById("teste").innerText = 10-texto.length;
if(10-texto.length > 0)
setTimeout("contador()", 10);
else
oDOM.body.innerText = texto.substring(0,10);
if(document.getElementById("teste").innerText == 0)
{
/*alert(texto.substring(0,10));*/
alert("Quantidade máxima de caracteres atingida!");
}
}