<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="text1" class="textarea" cols="100" onchange="gbcount(this,document.getElementById(''used''));"
onkeyup="gbcount(this,document.getElementById(''used''));" style="width: 220px;
height: 200px"></textarea>
已用字数:
<input disabled="disabled" maxlength="4" name="used" size="5" value="0" />
<script type="text/javascript">
function gbcount(message,used)
{
var lenE = message.value.length;
var lenC = 0;
var CJK = message.value.match(/[^\x00-\xff]/g);
var enter = message.value.match(/\r\n/g);
if (CJK != null) lenC += CJK.length;
if (enter != null) lenC -= enter.length;
used.value = lenE + lenC;
}
</script>
<form method="post" name="form">
<textarea id="text" class="textarea" cols="100" name="words" onchange="gbcount(this.form.words,this.form.used);"
onkeyup="gbcount(this.form.words,this.form.used);" rows="1" style="width: 220px;
height: 200px"></textarea>
已用字数:
<input disabled="disabled" maxlength="4" name="used" size="5" value="0" /></form>
</div>
</form>
</body>
</html> |