How can textarea shows value with return

J

Jack

Hello,
<%@ Language=VBScript %>
<%
Response.Write "<FORM name=form1>"
Set shipment_db = Server.CreateObject("ADODB.Connection")
shipment_db.Open "shipment"
Set shipmentTable = shipment_db.Execute("SELECT * FROM shipment WHERE ID
=39")
y=shipmentTable("Specification")
Response.Write "<TEXTAREA rows=4 cols=20 id=textarea1
name=textarea1></TEXTAREA>"
%>
<Script language=JavaScript>
document.form1.textarea1.value="<%=y%>"
</Script>
<%
Response.Write "</FORM>"
%>
shipment is a Microsoft Access's table,Specification is this table's field.
But this field has returns.That is to say
shipmentTable("Specification")="abc
edf
ghi"
textarea1 cannot shows shipmentTable("Specification")'s value.it shows none.
Thank you
 
J

Jack

Thank you,
use newString = replace(oldString,vbcrlf,"<br>")
The textarea can show value.But oldString's return be changed to "<br>".
That is to say:
if oldString="ABC
DEF
GHI"
The textarea shows "ABC<br>DEF<br>GHI".
I wait anyone's help.
 
R

Ray at

Why are you assigning the value to the text area using client side code like
that? That defeats half the purpose of ASP.

<%
Set shipment_db = Server.CreateObject("ADODB.Connection")
shipment_db.Open "shipment"
Set shipmentTable = shipment_db.Execute("SELECT * FROM shipment WHERE
ID=39")
y=shipmentTable("Specification")
' http://www.aspfaq.com/show.asp?id=2424
shipmentTable.Close : Set shipmentTable = Nothing
shipment_db.Close : Set shipment_db = Nothing

%>

<FORM name=form1>
<TEXTAREA rows=4 cols=20 id=textarea1 name=textarea1><%=y%></TEXTAREA>
</form>
 
R

Randy Rahbar

newString = split(oldstring,"vbcrlf")

Lose the quotes...
newString = split(oldstring,vbcrlf)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,177
Latest member
OrderGlucea
Top