...

View Full Version : how to keep lines in textarea



lli2k5
11-06-2006, 07:15 AM
whenever I record input from a textarea, it prints everything in one straight line.

How do I discover and parse the text area data based on the layout it was in the textarea?

_Aerospace_Eng_
11-06-2006, 07:17 AM
The question would be how are you recording the input?

rubenbuhr
11-06-2006, 07:44 AM
Here's one way...


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE> </TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<STYLE type=text/CSS>

</STYLE>
<SCRIPT type="text/javascript">
function mno(){
k=escape(document.getElementById('txt').value)

while(k.indexOf('%0D%0A')!=-1){k = k.replace('%0D%0A','<br>');}
document.getElementById('jkl').innerHTML=unescape(k)}
</SCRIPT>

<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY onload="mno()">
<textarea id="txt" rows=10 onchange="mno()">
abc
def
ghi
</textarea>

<div ID="jkl"></div>
</BODY></HTML>


Needs work around unescape(k)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum