Inserting text into a textarea

Inserting text into a textarea

am 04.09.2007 16:38:33 von cresh

Hello all,

I'm in need of some help with inserting text into a textarea. I have
this (below)which actually REPLACES all text in the text area. I just
need the text to be added to existing text there.

/begincode





......

value="AddText">


/endcode

This text replaces what's already in the box if I click the button.
What I want is to add the text when the button is clicked, not replace
what is already in the text area.

Thanks very much for any assistance.

DB

Re: Inserting text into a textarea

am 04.09.2007 16:53:33 von Captain Paralytic

On 4 Sep, 15:38, cresh wrote:
> Hello all,
>
> I'm in need of some help with inserting text into a textarea. I have
> this (below)which actually REPLACES all text in the text area. I just
> need the text to be added to existing text there.
>
> /begincode
>
>
>
>
>
> .....
>
> > value="AddText">
>
>
> /endcode
>
> This text replaces what's already in the box if I click the button.
> What I want is to add the text when the button is clicked, not replace
> what is already in the text area.
>
> Thanks very much for any assistance.
>
> DB

At a guess, something like:

function InsertText(mytext){
document.Form.message.value = document.Form.message.value+" "+mytext;


}

Re: Inserting text into a textarea

am 04.09.2007 16:54:46 von Captain Paralytic

On 4 Sep, 15:38, cresh wrote:
> Hello all,
>
> I'm in need of some help with inserting text into a textarea. I have
> this (below)which actually REPLACES all text in the text area. I just
> need the text to be added to existing text there.
>
> /begincode
>
>
>
>
>
> .....
>
> > value="AddText">
>
>
> /endcode
>
> This text replaces what's already in the box if I click the button.
> What I want is to add the text when the button is clicked, not replace
> what is already in the text area.
>
> Thanks very much for any assistance.
>
> DB

By the way, this is a javascript question. It has nothing whatsoever
to do with PHP!

Re: Inserting text into a textarea

am 04.09.2007 17:04:11 von cresh

> By the way, this is a javascript question. It has nothing whatsoever
> to do with PHP!- Hide quoted text -


You are correct, my mistake. Had multiple windows open. Thanks.

DB

Re: Inserting text into a textarea

am 04.09.2007 19:11:04 von Courtney

Captain Paralytic wrote:
> On 4 Sep, 15:38, cresh wrote:
>> Hello all,
>>
>> I'm in need of some help with inserting text into a textarea. I have
>> this (below)which actually REPLACES all text in the text area. I just
>> need the text to be added to existing text there.
>>
>> /begincode
>>
>>
>>
>>
>>
>> .....
>>
>> >> value="AddText">
>>
>>
>> /endcode
>>
>> This text replaces what's already in the box if I click the button.
>> What I want is to add the text when the button is clicked, not replace
>> what is already in the text area.
>>
>> Thanks very much for any assistance.
>>
>> DB
>
> At a guess, something like:
>
> function InsertText(mytext){
> document.Form.message.value = document.Form.message.value+" "+mytext;
>
>
> }
>
document.Form[0].message.value = document.Form.message[0].value+" "+mytext;

I think everyhing is an array, even when its only one element..
Or better something like

(document.getElementsByName('message'))[0].value += mytext;