<%
Session.CodePage=65001
Response.Charset="UTF-8"
textAreaMemoFieldRemainingLength=2000
if request.form("textAreaMemoField")<>"" then
textAreaMemoField = request.form("textAreaMemoField")
' NOTE: YOU MUST FILTER ALL INPUT USED...this is just an example.
' filter textAreaMemoField for XSS or other evil input here.
textAreaMemoFieldRemainingLength=2000-Len(textAreaMemoField)
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>field decrement</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005 Roderick Divilbiss">
<script type="text/javascript">
function textCounter(pField, pRemainingLength, pMaxLength) {
pRemainingLength.value = pMaxLength - pField.value.length;
}
</script>
</head>
<body>
<form action="fieldDecrement.asp" method="post">
<p><textarea name="textAreaMemoField" cols="50" rows="4" onKeyDown="textCounter(this.form.textAreaMemoField,this.form.remainingLength,2000);" onKeyUp="textCounter(this.form.textAreaMemoField,this.form.remainingLength, 2000);" ><%=textAreaMemoField%></textarea>
<input readonly type="text" name="remainingLength" size="1" maxlength="4" value="<%=textAreaMemoFieldLen%>">
<input type="submit" value="Submit">
</form>
</body>
</html>
© Coyright 2000-2008, Roderick (Rod) W. Divilbiss. Some rights reserved.
Except where otherwise noted, this site, all content, and all source code and markup is licensed under a Creative Commons License
Creative Commons License.
No part of this web site including all application code and examples may be used for commercial purposes without prior written permission from the author,
Roderick W. Divilbiss of Overland Park, Kansas, United States of America.