473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

fill a textarea

Hello,
how can fill automatically a textarea when opening a webpage.
I want to do this by a function that has been raised in js file.

thx
Oct 7 '06 #1
4 10390
Werner wrote:
Hello,
how can fill automatically a textarea when opening a webpage.
I want to do this by a function that has been raised in js file.
I belive the innerHTML is the way to get stuff into a textarea tag.

--
http://creativeobjectworld.com - (cow)
a free-form, text-based, browser-based, real-time, multi-user virtual
world.

Oct 7 '06 #2
wo*****@gmail.com wrote:
Werner wrote:
>>Hello,
how can fill automatically a textarea when opening a webpage.
I want to do this by a function that has been raised in js file.


I belive the innerHTML is the way to get stuff into a textarea tag.
I prefer setting textarea.value.

--
Ian Collins.
Oct 7 '06 #3
You need to use the 'value' attribute on the textarea (not innerHTML).
Furthermore, you need to access it AFTER the page has loaded, not
before. So, you need to put it in a function that is executed after
the page has loaded. So, the following won't work at all...
<script type="text/javascript">
<!--
document.getElementById('taMyText').value = 'asdfsdf';
// -->
</script>

This is what you want...

<script type="text/javascript">
<!--
window.onload = function(evt) {
document.getElementById('taMyText').value = 'asdfsdf';
}
// -->
</script>

Given this xhtml:
<textarea id="taMyText"></textarea>

Werner wrote:
Hello,
how can fill automatically a textarea when opening a webpage.
I want to do this by a function that has been raised in js file.

thx
Oct 7 '06 #4
ag******@gmail.com wrote:
You need to use the 'value' attribute on the textarea (not innerHTML).
Property, not attribute.
Furthermore, you need to access it AFTER the page has loaded, not
before.
You don't need to wait for the entire page to load, just for the textarea to
be created.
This is what you want...

<script type="text/javascript">
<!--
You don't want HTML comments in your script elements. They only serve to
protect browsers of the Pre-Netscape 3 generations (and they have much
bigger problems then rendering JS as text) and are actively harmful in
XHTML.
Given this xhtml:
<textarea id="taMyText"></textarea>
The rows and cols attributes are not optional.
>how can fill automatically a textarea when opening a webpage.
I want to do this by a function that has been raised in js file.
Why are you responding and /then/ quoting what you are responding to? Its
backwards and makes no sense.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David | last post by:
It's sad to say, but when using the AOL web site, like to send an email, they have a nifty capability such that when a window is resized, the textarea where the message is input expands not only...
2
by: John Ramsden | last post by:
I have a form containing a table whose cells include prompt text strings and input areas, one of which is a textarea. These are specified using only percent values, and I use some simple...
4
by: Csaba Gabor | last post by:
What I'd like to do is to be able to set the font of a textarea element to the same font that another element is using (say, for example, an <INPUT type=text ...> element, but if that's a no go,...
1
by: Volt | last post by:
is there any way to select and mark part of text in textarea by regular expression? i need to select the first string in textarea whitch is like xxxxx,xxx where x is any character
4
by: TJS | last post by:
can the rows and columns of a textarea element with an id be changed on the fly ? if so is there an example ?
6
by: wperry1 | last post by:
I am writing a small database utility to catalog all of my favorite ASM/JS/VBS... functions and scripts on an asp page. Everything is going smoothly except for one thing that I can't quite seem to...
2
by: Guenther Sohler | last post by:
Hallo, is it possible, to use javascript to automatically fill in forms, once a site is loaded ? that means, i would write a small html document, which has javascript embedded. it would first...
3
by: FunkHouse9 | last post by:
I'm working on a form to collect data in a textarea which and am trying to keep returns and spaces. I have a couple of functions that I Frankensteined together to replace returns with <br> and to...
4
by: fordie1000 | last post by:
Hi, I have been trying to do this for a few days now ... I'd appreciate any help or insights ... Basically I want to enter text into a web 'textarea' automatically ... here is what I thought...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.