IT Community - Software Programming, Web Development and Technical Support

How to read text area data line by line ?

This is a discussion on How to read text area data line by line ? within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi all I have one text area in my web page. When i am entering text line by line, it ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-18-2008, 04:35 AM
KiruthikaSambandam KiruthikaSambandam is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 332
KiruthikaSambandam is on a distinguished road
Default How to read text area data line by line ?

Hi all
I have one text area in my web page.
When i am entering text line by line, it could not output the text as such.
How to read text area data line by line ?

Thanks
KiruthikaSambandam
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-20-2008, 09:32 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: How to read text area data line by line ?

hi
check out the following link
p2p.wrox.com Forums - Read textarea
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-21-2008, 01:48 AM
rrrajesh84in rrrajesh84in is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 399
rrrajesh84in is on a distinguished road
Default Re: How to read text area data line by line ?

hi

use this method to split the text area line by line

document.write(str.split(" ") + "\n");
__________________
.....................................
''''''
Rajesh''''''
Ants. . . . . . Like me
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-23-2008, 09:25 PM
KiruthikaSambandam KiruthikaSambandam is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 332
KiruthikaSambandam is on a distinguished road
Default Re: How to read text area data line by line ?

Hi all ,

Using following script i can easily read text area data line by ..

<html>
<head>

<script type="text/javascript">

function convertText(){

var brPref = document.getElementById("oldbr").checked;
if(brPref == 1 || brPref == true){
var linebs = '<br>';
}else{
var linebs = '<br />';
}



var jpTag = document.getElementById("pTag").checked;
var jpTagbrTag = document.getElementById("pTagbrTag").checked;
var jbrTag = document.getElementById("brTag").checked;

var noBreaks = document.getElementById("oldText").value;
noBreaks = noBreaks.replace(/\r\n/g,"[-LB-]");
noBreaks = noBreaks.replace(/\n/g,"[-LB-]");
noBreaks = noBreaks.replace(/\r/g,"[-LB-]");


re1 = /\s+/g;
noBreaks = noBreaks.replace(re1," ");


if(jbrTag != 0 || jbrTag != false){
re4 = /\[-LB-\]\[-LB-\]/gi;
noBreaks = noBreaks.replace(re4,linebs+"\r\n"+linebs+"\r\n");
}else{
re4 = /\[-LB-\]\[-LB-\]/gi;
noBreaks = noBreaks.replace(re4,"</p><p>");
}

if(jpTag == 0 || jpTag == false){
re5 = /\[-LB-\]/gi;
noBreaks = noBreaks.replace(re5,linebs+"\r\n");
}else{
re5 = /\[-LB-\]/gi;
noBreaks = noBreaks.replace(re5," ");
}

if(jbrTag == 0 || jbrTag == false){
noBreaks ='<p>'+noBreaks+'</p>';
}

noBreaks = noBreaks.replace("<p><\/p>","");
noBreaks = noBreaks.replace("\r\n\r\n","");
noBreaks = noBreaks.replace(/<\/p><p>/g,"</p>\r\n\r\n<p>");

document.getElementById("newCode").value = noBreaks;

}



</script>

</head>
<body>
<form method="post" action="convert-line-breaks-br.php">
<input type="radio" id="pTag" name="linebreaks" value="p" style="visibility: hidden;" />
<input type="radio" id="pTagbrTag" name="linebreaks" value="pbr" style="visibility: hidden;" />
<input type="radio" id="brTag" name="linebreaks" value="br" checked="checked" style="visibility: hidden;" />
<input type="radio" id="newbr" name="thebr" value="yes" style="visibility: hidden;" />
<input type="radio" id="oldbr" name="thebr" value="yes" style="visibility: hidden;" />
<textarea id="oldText" name="oldText" rows="6" cols="36"></textarea>
<input type="button" name="Convert-Text-HTML" value="Convert Text to HTML" onclick="javascript:convertText()"
class="frmbtn" />
<textarea id="newCode" name="newCode" rows="6" cols="36" onclick="javascript:this.form.newCode.focus();this .form.newCode.select();"></textarea>
</form>
</body>
</html>

ThankQ
KirtuhikaSambambandam
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/5025-how-read-text-area-data-line-line.html
Posted By For Type Date
DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 01-18-2008 10:24 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using PHP from Command Line Sabari PHP Programming 4 12-18-2007 06:42 AM
How do I read command-line arguments with Perl? leoraja8 Perl 3 11-26-2007 06:43 AM
get a URL from cmd line input. amansundar Java Programming 6 11-20-2007 02:27 AM
How do I read command-line arguments with Perl? sivaramakrishnan Perl 1 07-23-2007 04:50 AM
Off-line Marketing for Your On-line Business montyauto eCommerce 1 07-13-2007 11:09 PM


All times are GMT -7. The time now is 07:06 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0