<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
<meta http-equiv="Content-type" content="text/html;charset=gb2312" />
<head>
<title>No.Javascrip倒计数文本框演示</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--
var maxLen=500;
function checkMaxInput(obj)
{
if(obj.value.length>maxLen)
{
obj.value=obj.value.substring(0,maxLen);
remLen.innerText="你输入的内容超出了字数限制";
}
else
{ remLen.innerText='还剩下'+(maxLen-obj.value.length)+'字';}
}
//-->
</SCRIPT>
<body>
<table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolorlight="#000" bgcolor="#808080" height="0">
<tr>
<td width="50%"><b><font color="#fff">倒计数文本框</font></b></td>
</tr>
<tr>
<td width="50%" height="110">
<form name="tickform">
<p align="center">
<textarea name="msgbox" rows="5" cols="31" onKeyDown="checkMaxInput(this)" onKeyUp="checkMaxInput(this)" style="background-color:#000;color:#fff;overflow:auto"></textarea>
</p>
</form>
</td>
</tr>
<tr>
<td width="50%">
<font align="right" id="remLen"><b></b></font></td>
</tr>
</table>
</body>
</html>