<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>textarea字数统计 </TITLE>
<script type="text/javascript">
function textCounter(min,max,obj)
{
if (obj.value.length > max){
obj.value = obj.value.substring(0, max);
}else
{
var v=document.getElementById("remLen");
v.value= max - obj.value.length;
}
}
</script>
</HEAD>
<BODY>
<form id="form1">
<textarea name="fcContent" rows="15" title="最少输入50,最多输入150文字!" onKeyUp="textCounter(50,150,this)" id="fcContent" style="overflow-x: hidden;width: 570px;"></textarea>
<hr/>
还可以输入:
<input name="remLen" type=text id="remLen" style="background-color:#D4D0C8;border: 0; color: red " value=150 size=2 maxlength=3 readonly />
</form>
</BODY>
</HTML>