Greg

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromGreg
ToMe
SubjectHelp with java commands sending to text areas
Date11 January 2006 21:45
Attachmentdemo page
Hello my name is Greg, I am new to this and have sat at my comp for about 18
hrs total now, trying to get this right.  I have read my tutor book from
page tutor, read your site, and a few others and cant seem to get it done.
Im embarrased to say it's a simple thing, I just want the text that a reader
inputs to get put in the text area when the generate button is hit.  I am
able to pop an alert with the data they input but getting it to the text
area has eluded me.  Please help a learner.  I thank you in advance for any
help you can offer.  I dotn want you to necessarily fix it for me, I just
want to "understand" where I am going wrong.

Greg
FromMe
ToGreg
SubjectRe: Help with java commands sending to text areas
Date12 January 2006 11:31
Greg,

> I am
> able to pop an alert with the data they input but getting it to the text
> area has eluded me.

Text areas can be referenced through their parent form using their name
attribute, and you can set their value using the .value property (make sure
the script runs _after_ the form has been created).

<form name="someform">
<textarea name="somearea"></textarea>
</form>
<script type="text/javascript">
document.forms.someform.somearea.value = 'hello world';
</script>

you can also use numerical indexes, although the names are generally easier.

document.forms[0].elements[0].value = 'hello world';


Hope this helps

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromGreg
ToMe
SubjectRe: Help with java commands sending to text areas
Date12 January 2006 20:21
Thank you very much, I was ready to throw in the towel.  I appreciate the
help.

Link to the finished product, well working product anyway, I will most
likely spruce it up someday, but for now my brain hurts.  thanks again.
[URL]
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.