I wrote a more cross-browser script here:
http://www.solidscripts.com/displayscript.asp?sid=1
Code:
<script type="text/javascript">
<!--
/*****************************
Maxtext v1.2
Copyright 2002 Robert K. Davis
******************************/
function getlength(x,y){
return x < y;
}
function textlen(x,y){
var thelength = x.value.length;
window.status = thelength + " of " + y + " maximum characters.";
}
function maxtext(x,y){
var tempstr = x.value;
if(tempstr.length > y){
x.value = tempstr.substring(0,y);
alert("Please limit your entry to " + y + " characters or less.");
}
textlen(x,y);
}
/*********************/
// -->
</script>
This uses a number of different techniques and it has been tested in Opera, Mozilla, Netscape 4.x, Netscape 6+, and IE.