<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script type="text/javascript">
function displayReminder(control)
{
debugger;
var countOfStrings = control.value.length;
var surplus = 100 - countOfStrings;
document.getElementById("divHint").innerText = "你共输入了" + countOfStrings + "字,还可以输入" + surplus + "字";
}
</script>
<BODY>
<input type="text" id="input1" onKeyUp="displayReminder(this);" >
<div style="float:left" id="divHint">
</div>
</BODY>
</HTML>
另:像这样客户端的表现工作,正是JS大显身手的时候,推荐看<javascript高级程序设计>
张荣华
|
老鸟四级
|园豆:2020
|
2008-03-18 19:42