View Full Version : click-content goes in textarea

09-23-2007, 04:20 AM
Hello im a newbie to javascript,
but I cant find this anywhere, I am looking for a code so when you click a button the button will place something in my textarea box.

I am using this for BBcode

so an example.
I click a picture and it places the bbcode into my html textarea box, can anyone help me! I think this is javascript?

09-23-2007, 05:15 AM
onClick="whatever.value += 'something';" or something similar to that.

That's the basic idea behind it.

You could just look at the script on a working page to get some idea how it works.

09-23-2007, 11:57 AM
thankyou, ill try to look for a script that has that....

so I have to give the textarea a value to so the onclick is sending it to the value.

i think thats right, Thankyou!

Is there a away anyone can post a script example, I have no clue!

09-23-2007, 12:31 PM
I found this but I was wondering if it is possible to make more input buttons do a onclick with different functions?

function addtxt(input) {
var obj=document.getElementById(input)
obj.value+="blah test 123"
<textarea id="textarea1"></textarea>
<br><input type="button" value="Write blah blah" onclick="addtxt('textarea1')">