<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function func(){
var wordnum=document.getElementById("textarea").value.length
if (wordnum>=71){
document.getElementById("textarea").value=document.getElementById("textarea").value.substring(0,69)
alert("max word is 70");
}else{
wordsNum.innerHTML=wordnum
}
}
</script>
</head><body>
字数:<span id="wordsNum"></span>
<p>
  <textarea id="textarea" name="textarea" cols="60" rows="10" onKeyDown="func()"></textarea>
</p>
</body>
</html>