Email conversation
From | Greg |
To | Me |
Subject | Help with java commands sending to text areas |
Date | 11 January 2006 21:45 |
Attachment | demo 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
From | Me |
To | Greg |
Subject | Re: Help with java commands sending to text areas |
Date | 12 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/
From | Greg |
To | Me |
Subject | Re: Help with java commands sending to text areas |
Date | 12 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]