This demo shows how to take plain text from a html textarea field and convert the text

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
December 28, 1999
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

TEXT to HTML Conversion routine


 

 

Code to the 1st page.

<HTML>
<HEAD>
<TITLE></TITLE>
<META name="description" content="">
<META name="keywords" content="">
</HEAD>
<BODY BGCOLOR=FFFFFF TEXT=000000 LINK=0000FF VLINK=800080>
<h1> ASP-Text to Html</h1>

<form action = "mask.asp" method = "post" >
<textarea wrap="virtual" name="Description" rows="12" cols="50"></textarea>
<p>
<input type="Submit" name="Next" value="Go" style="font-family: Arial; font-size: 7pt">
</p>
</form>
copyright &copy; 1999 hostmaster@reviewnow.com

</BODY>
</HTML>

Code to the 2nd page

<html>
<Head>
<Title> ASP - Text-to-Html </title>
</head>
<h1> ASP - Text-to-Html </h1>

<%
'Copyright 1999 William Mclaughlin
' Hostmaster@reviewnow.com
'this copyright notice Must stay with this code it is not to be given out without the permission of the owner
Copyright = "Copyright &copy; 1999 William Mclaughlin <br> <a href = mailto:""hostmaster@reviewnow.com"">hostmaster@reviewnow.com</a>"

%>


<%
if len(request.form("Description")) > 1200 then
response.write "<p>An error occurred while attempting to processing your submission.<br> Your submission has not been completed. <br> Please press the Back button on your browser, correct the error listed below, and re-submit the form.</p>"
    response.write "Error Information:<br>"
response.write "The text limit on the description field is 1200 characters. You have exceeded this limit. "
    response.write "<form>"
    response.write "<input type='button' value='Retry' onclick=history.back()>"
    response.write "</form>"
    response.end
End if
If IsEmpty(request.form("Description")) or request.form("Description")="" then
response.write "<p>An error occurred while attempting to processing your submission.<br> Your submission has not been completed. <br> Please press the Back button on your browser, correct the error listed below, and re-submit the form.</p>"
        response.write "Error Information:<br>"
    response.write "You must enter a Description."
    response.write "<form>"
    response.write "<input type='button' value='Retry' onclick=history.back()>"
    response.write "</form>"
    response.end
Else
    Description = request.form("Description")
End If
%>
<%
if Request.form("Description") <> "" Then

%>
<%

Dim Inputstring
Dim filenum
Dim HTTP
Dim FTP
Dim temp
Dim Pos
Dim Pos1
Dim Pos2
Dim endlength
Dim tempchar
Dim BeginningP
BeginningP = False
HTTP = "http://"
FTP = "ftp://"

Inputstring = Description

Do While ((InStr(1, Inputstring, HTTP, 1) <> 0) Or (InStr(1, Inputstring, FTP, 1) <> 0))
Pos = 0
Pos1 = InStr(1, Inputstring, HTTP, 1)
Pos2 = InStr(1, Inputstring, FTP, 1)

If Pos1 = 0 Then
Pos = Pos2
ElseIf Pos2 = 0 Then Pos = Pos1
End If
If Pos = 0 Then 'neither pos1 or pos2 are 0
If Pos1 < Pos2 Then
Pos = Pos1
Else
Pos = Pos2
End If
End If
response.write "<P>"
AddP Mid(Inputstring, 1, Pos - 1), filenum
' Response.write Mid(Inputstring, 1, Pos - 1)
Response.write "<a href = " & Chr(34)
Inputstring = Mid(Inputstring, Pos, Len(Inputstring))
spacefound = False
temp = ""
x = 0
endlength = Len(Inputstring)
Do
x = x + 1
tempchar = Left(Inputstring, 1)
If tempchar <> " " Then
If tempchar = vbCr Then
spacefound = True
Response.write Chr(34) & ">" & temp & "</a></p>" 'Temp taken out and
Response.write "<P>"
Else
temp = temp & tempchar
Response.write tempchar
Inputstring = Right(Inputstring, Len(Inputstring) - 1)
End If
Else
spacefound = True
Response.write Chr(34) & ">" & temp & "</a></P>"
Response.write "<P>"
End If
Loop Until (x = endlength) Or (spacefound)
If x = endlength Then
Response.write Chr(34) & ">" & temp & "</a></P>"
End If

Loop
AddP Inputstring ,filenum
Response.write "</P>"


Public Sub AddP(tempstring,filenumber)
Dim x
Dim tempchar
For x = 1 To Len(tempstring)
tempchar = Mid(tempstring, x, 1)
If tempchar = vbCr Then
Response.write "</P>"
Response.write tempchar
Response.write "<P>"
Else
Response.write tempchar
End If
Next


End Sub
%>
<% Else %>
Please ReEnter your information
<% End if %>
<%= Copyright %>
</body>
</html>

blog comments powered by Disqus
ASP CODE ARTICLES

- ASP Forms
- ASP: The Beginning
- Getting Remote Files With ASP Continued
- Inbox and Outbox Manipulation in ASP
- Relational DropDownList Using VB.NET
- Ad Tracking URL Hits
- Use ViewState to display one record per page...
- Send Email using ASP.NET formatted in HTML
- ASP File Explorer
- ASP/XML Interview questions by Srivatsan Sri...
- Pressing RETURN won't submit the form
- This shows how you get the TEXT of a combo r...
- Group Data by Adrian Forbes
- Multiple checkbox select sample
- Multiple checkbox select with all values sam...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials