Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Carriage Return in TextArea

Status
Not open for further replies.

esearing

IS-IT--Management
Aug 22, 2000
132
US
Can anyone tell me how to force a carriage return in a textarea box. Code below writes text to box but puts each iteration of LINVmmyy next to previous iteration.

*********************************************************
document.write (&quot;<textarea name='IBIF_adhocfex' rows='10' cols='50' value align='LEFT'>&quot;)
while (num <= sMths)
{
document.write (&quot;linv&quot; +sMth +sYear)
/***need forced return here**/
num=num +1
sMthi=sMthi +1
sMth=sMthi
sYear=sYeari
}
document.write(&quot;</textarea>&quot;)

*************************************
Current Output [LINV0101LINV0201]
Need [LINV0101
LINV0201]

Eric

If you create something idiot proof,
Nature will create a better idiot.
 
To place a carriage return in a textarea, all you need is to write the characters &quot;\n&quot; after each line:

*********************************************************
Code:
document.write (&quot;<textarea name='IBIF_adhocfex' rows='10' cols='50' value align='LEFT'>&quot;)    
while (num <= sMths)
{
document.write (&quot;linv&quot; +sMth +sYear +&quot;\n&quot;)
/***got your forced return above***/
num=num +1
sMthi=sMthi +1
sMth=sMthi
sYear=sYeari
}
document.write(&quot;</textarea>&quot;)[/code}

*************************************
 
Sorry, messed up the TGML. That should have been:

Code:
document.write (&quot;<textarea name='IBIF_adhocfex' rows='10' cols='50' value align='LEFT'>&quot;)    
while (num <= sMths)
{
document.write (&quot;linv&quot; +sMth +sYear +&quot;\n&quot;)
/***got your forced return above***/
num=num +1
sMthi=sMthi +1
sMth=sMthi
sYear=sYeari
}
document.write(&quot;</textarea>&quot;)
 
Many Thanks!

&quot;\r&quot; is what I was looking for but &quot;\n&quot; seems to work just as well.
Eric

If you create something idiot proof,
Nature will create a better idiot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top