%
'*******************************************************
'* ASP 101 Sample Code - http://www.asp101.com/ *
'* *
'* This code is made available as a service to our *
'* visitors and is provided strictly for the *
'* purpose of illustration. *
'* *
'* http://www.asp101.com/samples/license.asp *
'* *
'* Please direct all inquiries to webmaster@asp101.com *
'*******************************************************
%>
<%
Dim strScriptName
Dim strInputText
' Read in the script name so I know where to
' point the form's action to.
strScriptName = Request.ServerVariables("URL")
' Read in the input from the text area.
strInputText = Request.Form("txtWordCount")
' Check for empty input and ignore it...
If strInputText = "" Then
strInputText = "This is some text for the textarea!"
Else
' Echo out the input:
Response.Write "You entered:
" & vbCrLf
Response.Write "
" Response.Write Server.HTMLEncode(strInputText) Response.Write "" & vbCrLf ' Print out the counts we got: Response.Write "
It contained " _ & GetWordCount(strInputText) _ & " words and " _ & GetCharCount(strInputText) _ & " characters.
Enter some text: