<script language=javascript>
function CheckLength(txt, MaxChars) {
var X = txt.value
if (X.length > MaxChars) {
alert ('You have entered too many characters for this field. The maximum # of characters is' + MaxChars);
txt.focus();
txt.value = txt.value.substring(0,500);
}
}
</script>
<TEXTAREA Name='Whatever' Rows=6 Cols=45 onKeyUp="javascript:CheckLength(this, 500);"></TEXTAREA>