adding text to a textfield dynamically?

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Simply this is what I would like to accomplish. I want a text area, and when you click on a link, or button, it pastes text in the textarea, where the cursor is. Is this at all possible in perl, html, or do I have to use some javascript, dhtml?

Like if the user pressed the button ten times, it would paste the text in that textarea 10x.

Thanx for your help.

Californication

Pimpin like a pimp with an electrofied pimpin machine!

They have: 62 posts

Joined: May 2000

Well, you could print all the text to a file, and refer the file into the textarea.

#!/usr/bin/perl

open(HEH, ">>/path/to/file.txt");
print HEH "$texttogointextarea";
close(HEH);
'

Then have PERL file like this:

#!/usr/bin/perl

open(HEH, ">>/path/to/file.txt");
@text=;
close(HEH);

print <

heh

Hope that works.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

how will this be used?

if you use perl, it will be server side and slower
if you use javascript it'a be client side (and for me, harder to write)

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

the syntax for is:

<textarea>
Text goes here
</textarea>
'

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Max that wasn't the question I was asking. I know how to put text into a text area. But I want it to be empty upon load. Let them type in schtuff and then they can click a link, and it would paste some text in the textarea at the spot of the cursor.

I am going to post this question in the Javascript forum as well.

VulKen
[b]Take Me Drunk, I'm Home Again[\b]

Pimpin like a pimp with an electrofied pimpin machine!

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I know what you mean... Vorm had it wrong in his code.

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Woohoo! I figured it out, thanks to um..I forget who it was that gave me the info in the JavaScript Help Forum!

Simply the basis of it is

IT WORKS GREAT!

VulKen
Happier then I really should be!

Pimpin like a pimp with an electrofied pimpin machine!

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

you forgot the closing " again

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.