<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="../../api/jquery/jquery-1.5.2.min.js"></script>
<SCRIPT language="javascript">
function txtanum() //统计txta的输入字数
{
var maxl = 81;
var num = 80;
var content = $("#txtContent").val();
content.slice(0, maxl);
var nowlength = content.length;
if (nowlength >= 0) {
if (nowlength < num) {
$("#spid").text(num - nowlength);
} else {
$("#spid").text(0);
}
} else {
$("#txtContent").val(content.substring(0, maxl - 1));
}
if (nowlength == 0) {
$("#spid").text(num);
}
if (nowlength > num) {
$("#txtContent").val(content.substring(0, num))
}
}
</script>
</head>
<body> 你还可以输入<span id="spid">80</span>字</div>
<textarea id="txtContent" onkeypress="" class="zhongj_sou_as" tabindex="3" name="txtContent" onkeyup="txtanum()"
runat="server"></textarea></div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="../../api/jquery/jquery-1.5.2.min.js"></script>
<SCRIPT language="javascript">
function txtanum() //统计txta的输入字数
{
var maxl = 81;
var num = 80;
var content = $("#txtContent").val();
content.slice(0, maxl);
var nowlength = content.length;
if (nowlength >= 0) {
if (nowlength < num) {
$("#spid").text(num - nowlength);
} else {
$("#spid").text(0);
}
} else {
$("#txtContent").val(content.substring(0, maxl - 1));
}
if (nowlength == 0) {
$("#spid").text(num);
}
if (nowlength > num) {
$("#txtContent").val(content.substring(0, num))
}
}
</script>
</head>
<body> 你还可以输入<span id="spid">80</span>字</div>
<textarea id="txtContent" onkeypress="" class="zhongj_sou_as" tabindex="3" name="txtContent" onkeyup="txtanum()"
runat="server"></textarea></div>
</body>
</html>