| | |
to select a string from textarea
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
•
•
haii friends....
i want to select a particular string from textarea...i need it in javascript....
am using the tag <layout:textarea>
i did not need the whole ,but only a part...plzz help me...
In HTML a text area is just <textarea>.
You'll need a reference to the DOM node representing the text area, example:
textarea HTML
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<textarea id="mytext"> </textarea>
select whats inside the textarea with JS
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
// get the textarea by its id var txt = document.getElementById('mytext'); // theres the contents inside the textarea var value = txt.value;
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
btw: once you have the value of the string, you need to do some matching with regex or similar to get what you want out of the string.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
•
•
Join Date: Jan 2008
Posts: 71
Reputation:
Solved Threads: 1
•
•
•
•
haii friends....
i want to select a particular string from textarea...i need it in javascript....
am using the tag <layout:textarea>
i did not need the whole ,but only a part...plzz help me...
am using struts framework and <layout:textarea> is provided in it..
it has no property like "id" (ie..<textarea id="">)....
its syntax is like this..
<layout:textarea property="' key=""></layout:textarea>
"property" is used to represent the textarea ....
and wht is ment by "getElementById"..plzzz help
•
•
•
•
thankzzz....
am using struts framework and <layout:textarea> is provided in it..
it has no property like "id" (ie..<textarea id="">)....
its syntax is like this..
<layout:textarea property="' key=""></layout:textarea>
"property" is used to represent the textarea ....
and wht is ment by "getElementById"..plzzz help
-----
Re: getElementById
Once the HTML is rendered on the page, the browser will create a DOM (Document Object Model) representation of the HTML for programmatic access from JavaScript.
The DOM is a W3C specification that models XML data as Objects. It is quite simple. Take for example some XML:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<root> <child1 id="child1_id">Im a child of root</child1> <child2 id="child2_id"> <subchild1 id="subchild1_id">Im a child of child2</subchild1> </child2> </root>
There are many ways to model this XML document. The model used in browsers is the DOM. So in JavaScript, if you have a reference to the XML Document you could traverse it and select elements (DOM nodes) as well as manipulate it.
If the XML document reference is: XMLDoc, then the root would be:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
XMLDoc.documentElement;
<child1> would be:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
XMLDoc.documentElement.firstChild
or
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
XMLDoc.documentElement.childNodes.item(0);
or
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
XMLDoc.documentElement.getElementsByTagName('child1').item(0);
or
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
XMLDoc.documentElement.getElementsById('child1_id');
(These are all example of DOM methods for selecting Nodes/Elements).
getElementsById('child1_id') selects the child Node/Element with the id attribute 'child1_id'.
In HTML, the DOM is already created by the browser and available through document object. So you can use document to select any HTML element using DOM methods.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
document.getElementById('any_id_in_the_html_document');
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
- javascript works in IE but not working in firefox (JavaScript / DHTML / AJAX)
- Help With Messages in Mysql Stop Overwriting (MySQL)
- retrieving a web page from database (ASP)
- Calendar window is not coming for the Dynamic rows (JavaScript / DHTML / AJAX)
- Code help (Java)
- help with form/ display issues (ColdFusion)
- retrieving ids from dynamically created controls in asp.net (ASP)
- Please help with email form script (PHP)
- hover over text tips (JavaScript / DHTML / AJAX)
- Help need with Socket, Thread, and BufferedReader (Java)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Help! Tab content not working in FF
- Next Thread: AJAX Question
Views: 4468 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp ajaxjspservlets animate api automatically blackjack browser bug calendar captchaformproblem checkbox child class close cookies createrange() cursor dependent disablefirebug dom dropdown editor element engine events explorer ext file firehose flash form forms game gears google gxt highlightedword html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump libcurl margin math matrixcaptcha microsoft mp3 mysql object offline onerror onmouseoutdivproblem onreadystatechange parent passing pdf php player post progressbar rated regex runtime scroll search security session shopping size software solutions sql star stars stretch synchronous text textarea twitter unicode validation web website window windowsxp wysiwyg xspf \n






