www.webdeveloper.com
Results 1 to 4 of 4

Thread: put variable in a textarea

  1. #1
    Join Date
    Oct 2011
    Posts
    5

    put variable in a textarea

    i everybody
    im trying to merge two demo page whos finaly get latitude and longitude from googlemap and make it appear in a textarea to make it available to copy to clipboard by a button.
    this is my test page
    http://www.ma117.info/getadd4.html working with i.e. only
    im able to display latlng in
    Code:
    <div id="latlng"</div>
    but i need to make it appear in a textarea to be catch by clip variable
    Code:
    <td align="left"><textarea id="fe_text" cols=50 rows=5 ="clip.setText(this.value)">text here</textarea></td>
    iv try
    Code:
    document.getElementById('latlng').value
    but the error is undefined or OBJECT

    thanks to help me to understand

  2. #2
    Join Date
    Oct 2011
    Posts
    5
    now i know the diferrence between .value and .innerhtml
    and it wok with innerhtml

  3. #3
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Form's elements (like TEXTAREA) have a value. Other non-empty elements (like DIV) have either the innerHTML property (which is not quite standard, but it will work in most all of the cases) either childNodes,which can be of different types (textNodes, other tags, etc). If a non-empty tag accepts a text node as a firstChild, and only as a firstChild (no other childs nested), that text node is also to be read/written using various methods, like nodeValue (property of the textNode), text (property of the parentNode), textContent (property of the parentNode), data (property of the textNode) ...
    Last edited by Kor; 10-19-2011 at 08:45 AM.

  4. #4
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    element.innerHTML and element.children are standard methods in all current browsers, as mandated by the HTML5 spec, which although unfinished, has already been largely implemented...

    .children is like .childNodes, but with just the sub-elements; no messy text nodes or comments to deal with in elm.children.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles