Computing.Net > Forums > Web Development > Extract text between two strings

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Extract text between two strings

Reply to Message Icon

Name: gsrinivas
Date: September 18, 2009 at 07:19:15 Pacific
OS: Windows XP
Subcategory: HTML
Comment:

Hi, I am having below data format. I want to extract data between the <textarea> and </textarea>.

The textarea is not in same or different lines

<textarea>abc</textarea><textarea>xyz</textarea><textarea>123</textarea><textarea>3adf</textarea><textarea>abc</textarea>

Any help is greatly appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: shutat
Date: September 18, 2009 at 10:40:39 Pacific
Reply:

You can't really do that using html alone, but you can with either server side or client side scripting.

For example, using javascript.

<textarea onmouseover='alert(this.value);'>text area text</textarea>

For what you'd want though, you'd likely want to use "ids" for each textarea and then some sort of trigger.

<body onload='myfunct()'>
<textarea id='1'>.1.</textarea>
<textarea id='2'>.2.</textarea>
<textarea id='3'>.3.</textarea>

<script type='text/javascript'><!--

function myfunct() {

   alert(document.getElementById('1').value +
         document.getElementById('2').value +
         document.getElementById('3').value);
}
//--></script> 

Or something like that...

HTH


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Extract text between two strings

Text swapping www.computing.net/answers/webdevel/text-swapping/659.html

PHP and Mysql to create Auto-links www.computing.net/answers/webdevel/php-and-mysql-to-create-autolinks/522.html

Confict using two JavaScript tools www.computing.net/answers/webdevel/confict-using-two-javascript-tools/2036.html