...

View Full Version : Inserting text into textarea via link.



spl1nter
02-02-2004, 10:08 PM
I wish to have a set of links that when clicked on enter's some text into a textarea.

I am going to use it to create a forum to add things like "[url]" and so forth.

This is probably really simple, but I'm rubbish at Javascript.

Thanks a lot,

TD.

scroots
02-02-2004, 11:07 PM
document.formname.textboxname.value='your message';

scroots

spl1nter
02-02-2004, 11:17 PM
How would I implement this onto the page? I tried using <a href="javascript: onClick=document.formname.textboxname.value='whatever';></a>, but it posted the text on a new page?

I changed the name of the form and textbox to match the code.

I told you I'm useless at Javascript :P

scroots
02-02-2004, 11:29 PM
buttons tend to have better functionalty but you can use links.


<input type="button" value="Click ME!" onClick="document.formname.textboxname.value='boo'">



scroots

spl1nter
02-02-2004, 11:34 PM
Thanks a lot. Works great now :D

gruger
02-03-2004, 03:23 AM
I need more help ,

It dous work but I need the function to ADD some text or in this case a Tag to the textarea .

Like the function is now it overwrite all the data inside it :confused: .

Thanks in advance

glenngv
02-03-2004, 03:55 AM
onClick="document.formname.textboxname.value+=' added text'">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum