The code is similar, just a slightly different form of presentation.
The first type, when not entered, hides the
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
"Http://www.w3.org/TR/html4/loose.dtd" >
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Untitled Document </title>
<script language= ' JavaScript ' >
<!--code written by ridincal
var charNum = 0;
function Changeinfo ()
{
CharNum = Document.all.ipt.value.length;
var maxLength = document.all.ipt.maxLength;
if (maxlength>=charnum) document.all.info.innerhtml= "Send up to 20 words, remaining" + (20-charnum) + "word. ";
}
-->
</script>
<body>
<input type= "text" id= "IPT" onkeyup= "Changeinfo ()" Maxlength= "><span id=" info "> send up to 20 words </span>
</body>
The second type shows the remaining words directly
<meta charset= "gb2312"
<script language= "JavaScript"
MaxLen = 100;
function Checkmaxinput (form) {
if (Form.message.value.length > MaxLen) {
Form.message.value = Form.message.value.substring (0, MaxLen);
} else {
Form.remLen.value = maxlen-form.message.value.length;
}
</script>
<body>
<form name=myform>
<font size= "2" Color= "Red" > (you can enter up to 100 characters) </font><br>
<textarea name=message wrap=physical cols=28 Onkeydown= "Checkmaxinput (this.form)" ></textarea>
<br>
<font size= "2" > can also enter words: </ Font>
<input type=text name=remlen size=2 maxlength=3 value=;
Readonly>
</form> Body>