View Full Version : shortcut keys to place text in textarea?

11-01-2004, 07:53 PM

I'm trying to find a way to insert some text into a textarea by using a short cut key,, like F8 or something.

i've seen this done before but have no idea how to do it myself,
was hoping that some one might be able to show me an example?

thanks in advance for your time!

Willy Duitt
11-02-2004, 01:00 AM
This should get you started:

<script type="text/javascript">
function insert(evt) {
var key;
if (window.Event) key = evt.which;
else key = event.keyCode;
if(key == 45) {
stb = document.STORY.STORYBODY;
str = stb.value;
nme = 'Name ';
stb.value = str+nme;
document.onkeydown = insert;

<BODY onload="document.STORY.STORYBODY.focus()">
<form name="STORY">
<textarea name="STORYBODY" cols="75" rows="15" wrap="PHYSICAL"></textarea><br>


11-02-2004, 04:35 PM
but i'm not sure how it works,
what key do i push? and what gets inserted?

thanks again for your time!

11-04-2004, 05:29 PM
can anyone help me with this?

thanks agian for your time!