PDA

View Full Version : How do i do this?



chrisclick
August 30th, 2007, 07:36 PM
How can i get a javascript that

when me or a user presses a button and then the set content inside the button is inserte into a text area.

Anyone know? thanks

MTsoul
August 30th, 2007, 07:45 PM
<input type="button" value="mybuttontext" onclick="javascript: document.getElementById('textarea_id').value=this. value;" />
<textarea id="textarea_id"></textarea>

chrisclick
August 30th, 2007, 07:56 PM
how would i insert this into a link? instead of a button?

also, when i try them... this is for a blog... and when i enter text and press the button it removed all of the current text, how do i remove this

MTsoul
August 30th, 2007, 08:00 PM
<a href="javascript:void(0);" onclick="javascript: document.getElementById('textarea_id').value=this. innerHTML;">my link text</a>
<textarea id="textarea_id"></textarea>

chrisclick
August 30th, 2007, 08:06 PM
ok, i shall try that int he morning... night night :D