how to display RETURN characters from text fields in HTML
if you retrieve text from a form or a database field that contains a RETURN character and display it on the HTML page like <%= Request("vtext") %> or <%=(Recordset1.Fields.Item("vtext").Value)%> this will not display a newline on the HTML output, just a newline in the code. to actually produce a linebreak on the page you would need a HTML <br> tag. there are two ways of achieving this: a) you type the <br> tag into the textfield in the form or the database. this is a bit tedious, especially if you want to have userfeedback and don't want to trouble the users by having to enter HTML code manually. b) you dynamically replace the RETURN character with <br> here are samples of how to do it: VBScript: <%= Replace(Request("vtext"), Chr(13), "<br>") %> or <%= Replace(Recordset1.Fields.Item("vtext").Value, Chr(13), "<br>") %> JavaScript: <% or <% |
|
|