View Full Version : ASP-JSCript formating new lines
jetalomar
April 2nd, 2004, 09:40
I need a function to convert hard returns to <br> in a string coming from a textarea (form input)... In php that's nl2br().
in VBScript is The String = replace(TheString, vbCrLf, "<br>")
but that doens't work for JScript. can someone help me out on how to do it with JScript?
Suggestions?
nickc
June 7th, 2004, 10:52
Newlines in Javascript are represented as \n
Nick
Goofy
June 7th, 2004, 13:17
First of all, are you talking about JavaScript or JScript. This is a frequent mistake made by many developers. It's important to know that these two are NOT the same.
Anyway, assuming you are talking about JavaScript and your are writing raw text into the document you could use the \n approach. However, that itself cannot detect hard returns parsed by the form. Take a look at this code. https://www.quickbase.com/db/6mztyxu8?a=dbpage&pagename=QuickBaseClient.js The ParseDelimited function should grab your interest. Let me know if it helps.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.