...

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



angst
11-01-2004, 06:53 PM
Hello,

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!
-Ken

Willy Duitt
11-02-2004, 12: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;
stb.focus();
}
}
document.onkeydown = insert;
</script>
</HEAD>

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


.....Willy

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

thanks again for your time!
-Ken

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

thanks agian for your time!
-Ken



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum